If you change the layout or style of your website using CSS you may have an issue where the old style-sheet is being used, meaning the page style or layout may look wrong.
The problem is that, until you force a page refresh, your visitors will be using a cached version of the CSS style-sheet.
The caching might be enabled by manually setting the headers or by adding "css" to the caching settings in .htaccess - or it's possible that it is happening outside of your control.
In order to force all visitors to your site to download the new style-sheet next time:
- Update the code in your template or main page that links to the style-sheet:
- change .../style.css
- to .../style.css?v=NewVersionNumber
You can replace
NewVersionNumber with whatever you like, perhaps the current date.
Job done! Adding or changing the parameter (after the question mark) forces a re-fetch of the updated style-sheet, (because browsers will views it as a different file) and hopefully all visitors to your site will see the correct, updated version next time they view it!
No comments:
Post a Comment