IE history
I am generating some png charts and excel files using mysql database. I am showing charts as images in my web application, but from time to time IE users do not have access to the latest version of the files because IE shows them the previous downloaded data (charts and excel files).
How can you prevent this? On the client side, what can be done?
My web application is written in PHP. What approach should I take to get IE to download new files?
a source to share
Another approach you can use is to add a unique query string to the images you are showing. In the image handler, you can ignore the data that is actually passed in the query string, but IE will treat URLs with different query strings as unique and therefore requires each one to be loaded without using the cached version.
For example change:
<img src="mychart.png>
at
<img src="mychart.png?timestamp=0512200911090000">
will help you avoid IE cache.
a source to share
HTML meta might work, but using PHP headers is efficient and more correct ( see here ). The article also covers caching of downloadable / non-html files.
Caching can be done in one of these ways in PHP (use the before headers to stream the image content):
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
?>
or
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
?>
a source to share