Bad cache expiration policy for images loaded with Javascript




9 years ago
6 years ago


(Reporter: yannack, Unassigned)


3.6 Branch
Windows Vista

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [testday-20120615])



9 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv: Gecko/2008102920 Firefox/3.0.4

i am working with some caching issues. I have some javascript code which loads images from various websites, and refreshes these images, by simply clearing the source of the img or by changing the background of the iframe, depending on the type of display. However, I have found that in many cases, Firefox doesn't reload the image from source but uses the cached version; and this despite the fact that there is a Expires, last Modified, and Cache-control:max-age set so as to have an expiration after one second. Internet Explorer does not have this problem. I can successfully reproduce this issue on Firefox 2 with Linux, Firefox 3.0 with Ubuntu-Linux, Firefox 3.1beta2 with a custom Linux, and Firefox 3.0.4 for Vista.

Here is a sample html page which doesn't reload properly with firefox, but does with IE:


function clearbg(){

function setbg(){

<body onload="setbg();">
<div id="mydiv"></div>
<iframe id="myframe" src="">
<img src="" id="mypic">

Reproducible: Always

Steps to Reproduce:
1. make a webpage which uses JS to show and then hide an image which shouldn't be cached for more than a second
2. set the refresh timers to above a second
3. observe Firefox not reloading image
Actual Results:  
Firefox doesn't reload images where it should

Expected Results:  
It should reload the images
This is a mass search for bugs which are in the Firefox General component, are
UNCO, have not been changed for 500 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile,, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]

Comment 2

7 years ago
I have juste performed the test as I had described the first time around, using a different image for the source as this source is no longer available. 
I confirm this problem is still present, there is no way of having the image be refreshed when reloaded into a page, even if it has expired.
Whiteboard: [CLOSEME 2010-11-01]


7 years ago
Version: unspecified → 3.6 Branch

Comment 3

7 years ago
I am running into a similar problem with my development. I am modifying an img tag's src attribute and if I end up putting the src attribute to a previous URL, that the browser had made a request, for it will not request the image again.

An example of the code is here:

The first image is cached so it shouldn't re-request it. The second image which is a no-store, no-cache is not being requested when it is set a second time.

If the browser was respecting the caching header the captcha should be a different image each time the captcha comes up.

Comment 4

7 years ago
Bug 183470 seems to be addressing a similar issue but it has deviated a bit.
Firefox 3.6 is now EOL, please try latest version of Firefox and feel free to open if it reproducible on latest build
for support
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
Whiteboard: [testday-20120615]
You need to log in before you can comment on or make changes to this bug.