|image caching in firefox|
I have been trying to create a slideshow of random pictures on my website. It has been quite succesful (it works perfectly in IE) but Firefox refuses to cooperate... It seems to have something to do with the way Firefox caches pictures, but I'm not sure.
There is a html file, which puts rotate.php as a picture on the page.
There is a PHP file, rotate.php, which randomly outputs a picture.
I'll post a part of rotate.php below..
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"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
thumb($filename, 170, 170); // thumb is a working thumbnailgenerator, it outputs correctly in both browsers)
[edited by: jatar_k at 5:19 pm (utc) on Jan. 15, 2006]
[edit reason] no urls thanks [/edit]
It seems to be working SOMETIMES though.. Weird.
In Firefox, right click on the image and select 'View image'. Now, in the white area around the image, right click and select 'View page info'. You should see what Firefox thinks of the expired and modified dates. Are they what you expect?
Thanks for the advice. Funny thing is, when I click "View Image" it *does* load *another* picture. And it says:
Cache source: Memory cache.
I'm not sure what that means. Anyone?
Firefox has two caching options: Memory and disk.
The memory cache includes (correct me if I'm wrong) elements from recently opened pages, such as the images from webmasterworld.com for me now.
The disk cache keeps everything that isn't in the memory cache until it expires.
One solution for you would be to have rotate.php show an img src=$random_image.jpg tag instead of outputting the image directly.
Well there should be a way to prevent FF to put my rotate.php output in its memory cache, right?
Apparantly my header as it is now, doesn't do it. (view code in first message)