I have been developing many updates for my website, but many clients are complaining that they didn't get any updates. When i asked them to clear the browser cache, their problem is solved. But its difficult for clients with below average computer literacy to clear cache. So is there any way to detect cached data in browsers and reload cache if there's change in my site contents? I had developed my site on HTML,Angular JS.
Asked
Active
Viewed 2,697 times
1
-
Add Version in your scripting files. (using Programing) – Shan Dec 20 '16 at 05:09
-
duplicate question. checkout this link. http://stackoverflow.com/questions/1922910/force-browser-to-clear-cache – Kalyan Dec 20 '16 at 05:12
-
use cache busting – claudios Dec 20 '16 at 05:17
2 Answers
2
you can use some extensions with your js, css files callings like
<header>
<link href="MyFolder/my.css?v=1.5">
<script src="myFolder/my.js?v=1.5">
</header>
v = version you can use a global variable to hold value of version then you can increase version number with your updates

Azad
- 5,144
- 4
- 28
- 56
1
Simply add cache busting.
Add timestamp
"?ts=" + new Date().getTime()
or As in your case, for build deployment its better to use version. Fetch your version number from config file
var ver = "?ver=" + config.version;
then you url look like
app.js + ver => app.js?ver=1.0.1
For version number in config you may keep it on client side config or get it from api on first hit and save it.
If you are using requirejs then its so simple just add value like this:
require.config({ urlArgs: ver});
It will automatically append it in every Js url.

Abhishek Rana
- 36
- 5