Possible Duplicate:
Force refresh of cached data
Whats the best practice for updating the css style sheet after a website goes through visual changes?
I recently updated my webpage with new images and updated the css. When my friend viewed the site his browser had the previous css rending with new images for some reason. He has visited the site before. From my understanding the style sheet was not refreshed but they images changed on his first launch of the site causing it to appear incorrectly. After he refreshed the page it updated the css and looked alright though.
Do I need to change the name of the css after major changes to force the new style sheet to be downloaded? Or is there a way to cause the browser to perform a mandatory reload of the style sheet?
He has the previous version because it is cached. On his end, he can “force” a fresh CSS file by using
cntrl+f5(on chrome) or his browsers equivalent. Or merely empty his cache.For you, what you can do is change the name of the stylesheet. You could do this by adding a
?=xto the stylesheet href. It makes the browser think it is a new version, but is infact just the old version.If you never want the file to be cached again (which I don’t recommend) you could add a timestamp to the
?=, but again, I don’t recommend that