new image doesn't load in IE
Hi,
Will anybody please help me with this.
The bar chart image is created and stored using php code. each time the page is hit, the new image is created and displayed.
The firefox always dispaly the new image but IE always dispaly the old image and I have to refresh inorder to see the new one. may be this is due to cache.
Will anyone please guide me how to overcome this.
Thanks in advance!
crazynp
Junior Poster in Training
58 posts since Jan 2007
Reputation Points: 10
Solved Threads: 2
Change the name of the file each time. That will prevent caching.
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
Change the name of the file each time. That will prevent caching.
Thanks stymiee !
but do you think this is an efficient solution? The number of files will get increasing and that need to be deleted.
Is it possible to disable the cahing?
Regards!
crazynp
Junior Poster in Training
58 posts since Jan 2007
Reputation Points: 10
Solved Threads: 2
There's no reliable way to disable caching. You can send send out headers to prevent caching but I've found this to not be 100% effective. A better solution might be to use PHP to output the image. Then you can append a timestamp to the filename to make it look unique: <img src="/images/chart.php?1091343214"> .
The php code in chart.php would look like this:
<?php
header('Content-type: image/gif');
$fn = fopen("./chart.gif", "r");
fpassthru($fn);
?>
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
Thanks stymiee !
but do you think this is an efficient solution? The number of files will get increasing and that need to be deleted.
Is it possible to disable the cahing?
Regards!
There's no reliable way to disable caching. You can send send out headers to prevent caching but I've found this to not be 100% effective. A better solution might be to use PHP to output the image. Then you can append a timestamp to the filename to make it look unique: <img src="/images/chart.php?1091343214"> .
The php code in chart.php would look like this:
<?php
header('Content-type: image/gif');
$fn = fopen("./chart.gif", "r");
fpassthru($fn);
?>
If the PHP generated bar graph image is being saved as a file, then you can also use the method suggested by stymiee with the timestamp directly on the image...
eg: <img src="/images/chart.jpg?1091343214" />
Even though its a jpg extension it should still bypass most HTTP caches (I have not tested this though). That way you don't have to pass the image data to PHP.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
Thanks to both of you. I will try to implement this after few days. Once again thank you both for help and suggestion.
crazynp
Junior Poster in Training
58 posts since Jan 2007
Reputation Points: 10
Solved Threads: 2