I have developed SPA application in Angularjs(version 1.6) and .net web api2, deployed on IIS server and it is working fine. Application has plain HTML files which gets loaded into ngView angular tag based on angular route changes. The issue I am facing is if I make any changes to html files and deploy the application, user doesn't see updated changes on html page when they use the application. The issue persists even if they clear the browser cache before logging into application. However they see updated changes if they visit the page and press "Ctrl + F5". I am clearing template cache using $templateCache.removeAll() when the application is launched but issue still persists. Can someone please help to fix this as users are getting annoyed because of this.
Asked
Active
Viewed 98 times
1
-
How are you deploying this? What hosting service are you using? – AJ Funk Mar 24 '17 at 17:58
-
Please use cache busting – harishr Mar 24 '17 at 18:02
-
The browser does caching which is beyond the control of the AngularJS framework. See [MDN HTTP Reference - Caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching). – georgeawg Mar 24 '17 at 18:07
-
@AJFunk I am deploying it on IIS web server with click once deployment of Visual studio – Prabi Mar 24 '17 at 18:20
-
@harishr could you please tell me how to use cache busting. I am not aware of it – Prabi Mar 24 '17 at 18:21
-
@georgeawg even if user clears the browser cache issue still persists – Prabi Mar 24 '17 at 18:22
-
You stated that the problems goes away when the user presses ctrl-F5. **. Ctrl-F5 forces a cache refresh. See [What requests do browsers' “F5” and “Ctrl + F5” refreshes generate?](http://stackoverflow.com/a/385384/5535245). – georgeawg Mar 24 '17 at 18:31
-
@georgeawg yes problem goes away if user press Ctrl+F5. However if user manually clears cache (by going into internet options) and then logins problem remains – Prabi Mar 24 '17 at 18:43
-
what build system are you using?? gulp? if yes you should use `gulp-rev`, if you are manually adding scipt js files in index.html then you should append it with query string.. just google `cache busting techniques` you will get the answer – harishr Mar 26 '17 at 06:33
-
@harishr I am not using gulp. js files are fine. I am talking about html files which I load in ngView using angular route. – Prabi Mar 27 '17 at 15:11