Reputation: 173
We have beta testing a new version of a website which is similar to the previous version. I see the old and new versions conflicting due to the previous version being cached in my browser. I assume this will happen to most of our users who don't clear their browser cache regularly. How do I ensure that the new website is rendered without such cache conflicts?
Upvotes: 1
Views: 862
Reputation: 127
The best way I know is to add a parameter to your css file.
<link rel="stylesheet" href="/stylesheets/styles.css?{{ site.time | date:'%Y%m%d%U%H%N%S' }}">
We use Jekyll to run our site, and using liquid templating I added a time stamp to end of the main css file. Every time we deploy a new timestamp is generated, telling a browser to download the css file and not to use the cached version.
Not sure what you are using to run your site but to test you can statically test this by adding a "?" at the end of your css file and add random number. If you are using any sort of backend you can set this dynamically.
Upvotes: 1