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?
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.
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.
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).
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;
}
};
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
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
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
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
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
Working solution. Should probably go to the core via a PR... After further testing :). The appendRndToUrl function is extracted from umbraco.services.assetsService.
Deleting the
\App_Data\TEMP\ClientDependency
folder also does the trickrefer to Changes in Plugins' js file not applied due to cache
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.
is working on a reply...