Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shane 40 posts 193 karma points
    Jan 30, 2015 @ 12:06
    Shane
    0

    Force plugin views to be cleared from cache

    Hi,

    I'm working on a backoffice extension for Umbraco 7. The new custom section I'm creating will be used for all users external to the business (They will not have access to the standard Content, Settings etc.)

    The problem I'm coming up against if the agressive caching of the HTML views in the App_Plugins folder. The client dependancy framework handles the JS and CSS changes well but when I make changes to the views it seems the only way is for the user to manually clear the cache in their browser. With users being external this isn't ideal.

    Is there any way to trigger these to be cleared from the cache?

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 31, 2015 @ 09:58
    Jan Skovgaard
    1

    Hi Shane

    Is the site gone live yet? If it's just on a testserver you should be able to set the debug attribute in the web.config to false. Then it should not be cached - But if you're deploying to the live site then this of course is not an option.

    /Jan

  • Shane 40 posts 193 karma points
    Feb 01, 2015 @ 09:53
    Shane
    0

    Hi Jan,

    The problem happens in dev and live. I don't think .html files are managed by the client dependancy framework so the debug attribute makes no difference.

    It's not a problem for dev as we no to clear the cache but I can't expect end users to do the same.

    Thanks

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 02, 2015 @ 07:22
    Richard Soeteman
    0

    Hi Shane,

    Indeed Client Dependency is giving issues. In my setup I set debugmode in web.config and I delete the client dependency folder during compilation in Visual studio (using a post build event).

    Best,

    Richard

  • Pavel Budik 12 posts 71 karma points c-trib
    Jun 30, 2015 @ 09:45
    Pavel Budik
    0

    Hi,

    I hit the same issue, unfortunately don't have time ATM to test further, but wouldn't something like this help?

    https://gist.github.com/ProLoser/6181026

    Just use CD version in place of cacheBustVersion var.

    Pavel

  • Pavel Budik 12 posts 71 karma points c-trib
    Jul 07, 2015 @ 14:14
    Pavel Budik
    0

    Working solution. Should probably go to the core via a PR... After further testing :). The appendRndToUrl function is extracted from umbraco.services.assetsService.

    angular.module('umbraco.resources').config(["$provide", function ($provide) {
        return $provide.decorator("$http", ["$delegate", function ($delegate) {
            var get = $delegate.get;
            $delegate.get = function (url, config) {
                // Check is to avoid breaking AngularUI: "template/.."
                if (url.indexOf('.html') > -1 && url.indexOf('template/') == -1) {
                    url = Utils.appendRndToUrl(url);
                }
                return get(url, config);
            };
            return $delegate;
        }]);
    }]);
    
    var Utils = {
        appendRndToUrl: function (url) {
            //if we don't have a global umbraco obj yet, the app is bootstrapping
            if (!Umbraco.Sys.ServerVariables.application) {
                return url;
            }
    
            var rnd = Umbraco.Sys.ServerVariables.application.version + "." + Umbraco.Sys.ServerVariables.application.cdf;
            var _op = (url.indexOf("?") > 0) ? "&" : "?";
            url = url + _op + "umb__rnd=" + rnd;
            return url;
        }
    };
    
  • Carlos Casalicchio 176 posts 735 karma points
    Sep 04, 2019 @ 14:58
    Carlos Casalicchio
    0

    Deleting the \App_Data\TEMP\ClientDependency folder also does the trick

    refer to Changes in Plugins' js file not applied due to cache

  • Om 2 posts 72 karma points
    Jan 14, 2021 @ 16:44
    Om
    0

    I found one solution , it only works if updated html file is referenced by some .js file.

    suppose some controller referencing your html file in which you have made some changes

    pathName = 'home.html'

    update this assignation to

    pathName = 'homeUpdatedDate.html'

    html caching problem will solve.

    Happy coding.

Please Sign in or register to post replies

Write your reply to:

Draft