karthik80c
asked on
Cache clearing in php website
My website is looking different in different websites. Any update on CSS is not reflecting immediately in firefox but where as safari and chrome show the modification immediately.
Is there a way to add a code which clears the existing cache whenever the website loads and uses the latest style sheet.
Is there a way to add a code which clears the existing cache whenever the website loads and uses the latest style sheet.
However there is one big limitation; User Settings.
You have no control over the user setting and the the browser will not refresh cache if the user settings explicitly prevent it; unfortunately many users have restricted cache setting to optimize response time, especially if they are on a slow connection or use a lot of sites heavy on graphics or videos.
Cd&
You have no control over the user setting and the the browser will not refresh cache if the user settings explicitly prevent it; unfortunately many users have restricted cache setting to optimize response time, especially if they are on a slow connection or use a lot of sites heavy on graphics or videos.
Cd&
ASKER
Thank you Computer and Coboldinosaur.
Coboldinosaur
- then so what would be the best solution for this Coboldinosaur. Please let me know.
Thanks
Coboldinosaur
- then so what would be the best solution for this Coboldinosaur. Please let me know.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
The solution Dave offers is a commonly used approach. You can just add the version number to the new file. The only drawback the approach has is if you are delivering static pages with the file names hard-coded; in which case you will need to change the file name on every page.
Cd&
Cd&
Header set Cache-Control "no-cache, no-store"
or through PHP:
header('Cache-Control: no-cache, no-store');