http - Why doesn't Firefox redownload images already on a page? -
I just read this article:
A firefox behavior (and I think some other Browsers) I understand the way:
If I take any webpage and try to insert the same picture several times in javascript, the image is downloaded only once, even if I want to say to all the necessary headers that "Never use Cash" (See article)
I know that the work is working (such as the endquote query string at the end of the URL) but why Firefox works, if I say that There is no image to be cached, whenever I try to insert it again, then why is the image taken from the cache?
Plus, is it used for cash? (I think this is a memory cache)
Is this behavior only for dynamic inclusion for example? No answer :) I have just tested it and will redirect the same header to the JS script every time you attach the script to the DOM, then it will be redeemed by Firefox.
PS: I know you're thinking that I need to do this (forced to add the same image many times and to download it again, but it's the work of our app The way is)
Thank you
Good answer: Firefox will store images for current page loads in memory cache, even if you specify that they do not have to cache .
You can not change this behavior, but it is weird because it is not the same for example for javascript files
Does someone tell or describe Firefox cache works Can someone link to a document?
What you're working on here is only partial caching.
The whole idea of embedding images by context by the URL is that you can refer to the same URL multiple times, and the browser loads it only once.
Basically if you type HTML (say index.html
):
& lt; Img src = "hello.jpg" /> & Lt; Img src = "hello.jpg" />
In this case, the browser only invites 2 HTTP requests: a index.html
and hello.jpg
.
Whatever you have to do, it is "fake" that the images are full of different URLs. There are several ways to do this.
The easiest solution is to add an additional prefix at the end of the URL. For example, if you want to load an image twice, you can add:
& lt; Img src = "hello.jpg? 1" /> & Lt; Img src = "hello .jpg? 2" />
For this reason the browser will send an HTTP request to retrieve each image: a hello.jpg? 1
and hello.jpg? 2
. However, some web servers / browsers can still optimize it and send only one request hello.jpg
.
If this does not work, you can also try to pass your image through a script like PHP, as suggested in another reply.
Comments
Post a Comment