user2100125 user2100125 - 1 month ago 23
AngularJS Question

AngularJS browser cache issues

Good morning, I have a web application in production environement. The users are using it every day, when I publish an update and a user comes back to the web application he views the old version of the web application. He needs to refresh the browser to load the new version. How can I solve this problem? I cannot tell hundreds of users to refresh the page every time I publish an update (3-4 times a week).

Answer

A simple solution would be to add query strings representing timestamp or session id to your files.

For e.g., in our spring applications, we simply use :

<script src="js/angular/lib/app.js?r=<%= session.getId()%>"></script>

You can implement the same solution in your server specific implementation too.