Reputation: 528
When deploying a new design to a website, how can you get around people having to clear their browser cache to see the new changes?
Is there anything that can be put in place, once a new website version is uploaded that automatically strips the cache upon load or how do other people get round this?
The issue I'm having is, just deployed a website where a holding page has been residing for a couple of months - but now the site has switched over some people's designs of the new website are a bit strange until they clear the cache....how can this preventing, what techniques do Facebook/Twitter and the likes use?
Upvotes: 1
Views: 42
Reputation: 13283
Versioning.
Basically, change either the file names or where the files are located.
Current version:
/v1/css/style.css
/v1/images/penguin.png
....
New version:
/v2/css/style.css
/v2/images/penguin.png
...
Upvotes: 1
Reputation: 9725
It's a complex topic, however the quick and dirty way is to change the name of your stylesheet file and update your html accordingly. this will make the browser load the new file and avoid caching issues.
alternatively you could append a querystring to the stylesheet url, in your html:
...style.css?version1
this will also force the browser to reload the same file. every time you re-deploy, you could update the version number.
there are many more advanced techniques but these should work for you in the meantime
Upvotes: 1