I updated the images and stylesheets on my website, but I am getting phone calls from clients saying my layout looks weird. When they refresh the page, it looks normal.
How do I stop their browsers from loading my website from cache?
I updated the images and stylesheets on my website, but I am getting phone calls from clients saying my layout looks weird. When they refresh the page, it looks normal.
How do I stop their browsers from loading my website from cache?
use one of the static file versioning techniques
such as adding a querystring to the static file /img/image1.jpg?v=1.0
or rename the file /img/image1_1.0.jpg
this applies to any image, JavaScript, or CSS files
You can use meta tags to tell the browser not to cache the page:
You can also generate raw headers. Please read HTTP specifications
<?
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>