Reputation: 565
I have this php-page with some html and javascript code on it. Some javascript is generated dynamically with php.
So when I change something on the server on this page and reload the page in IE, it uses the cached one. So the problem is that we have to tell our users to refresh their cache every time we do an update.
Using the trick with lalala.css?version=20120412 won't work since the code is in the php-file.
In Chrome and Firefox it works great.
Even if we change a setting in the database and php prints that into the file, the next time an IE user goes to that page, it will use the old cached version, and the changed setting will not be in effect. It doesn't even try to load the page.
Shouldn't the browser at least compare a checksum or something with the server or something?
I don't understand this. Please help.
Upvotes: 0
Views: 284
Reputation: 1509
<link type="text/css" rel="stylesheet"
href="lalala.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" />
Upvotes: 0
Reputation: 5196
paste this code on top of php file
<?php
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");
?>
Upvotes: 1