Why doesn't Firefox redownload images already on a page?

Posted by vvo on Stack Overflow See other posts from Stack Overflow or by vvo
Published on 2010-02-03T13:32:39Z Indexed on 2010/04/19 20:53 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
|

Hello, i just read this article : https://developer.mozilla.org/en/HTTP_Caching_FAQ

There's a firefox behavior (and some other browsers i guess) i'd like to understand :

if i take any webpage and try to insert the same image multiple times in javascript, the image is only downloaded ONCE even if i specifiy all needed headers to say "do no ever use cache". (see article)

I know there are workarounds (like addind query strings to end of urls etc) but why do firefox act like that, if i say that an image do not have to be cached, why is the image still taken from cache when i try to re-insert it ?

Plus, what cache is used for this ? (I guess it's the memory cache)

Is this behavior the same for dynamic inclusion for example ? ANSWSER IS NO :) I just tested it and the same headers for a js script will make firefox redownload it each time you append the script to the DOM.

PS: I know you're wondering WHY i need to do that (appending same image multiple times and force to redownload but this is the way our app works)

thank you


The good answer is : firefox will store images for the current page load in the memory cache even if you specify he doesnt have to cache them.

You can't change this behavior but this is odd because it's not the same for javascript files for example

Could someone explain or link to a document describing how firefox cache WORKS?

© Stack Overflow or respective owner

Related posts about http

Related posts about cache