CSS Caching Hack
Great tip from Stefan Hayden on how to make sure users get the latest version of you stylesheets when you do an update.
The trick is to pass a variable on the end of the CSS file like so:
<link rel="stylesheet" href="http://www.stefanhayden.com/style.css?version=1" type="text/css" />When a browser looks to see if it has anything cashed it compares file names. If you have “style.css” in your cashe then it’s not going to download it again. But if the browser compares “style.css?version=1″ to what the new HTML is “style.css?version=2″ then the browser thinks they are different files and needs to download the new CSS file.
About this entry
You’re currently reading “CSS Caching Hack” an entry on #adamSentz{dot:com;}
- Published:
- 4.22.09 / 2pm
- Category:
- CSS, Web Design