Tuesday, March 15, 2016

Forcing clients to reload on new application releases

Many Web application clients get data via Ajax. The resources including the CSS and JavaScript files  are never reloaded once loaded in this way. However, some new features require the clients to retrieve the updated resources from the server. This can be achieved by maintaining a service generated release number on the client, and compare that number with the current release number on the server via Ajax. If the release number is updated, then run
window.location.reload(true);
You will need to either disable the the cache for the resource of release number, or set cache to false of the Ajax GET request.