Lets say that i have img tag like this,
<img src = "myimage.jpg" width ="50" height = "50">
When browser first encounter this, it will download the image file and will render it. When again refresh my page, when the browser encounters this line, will it send request to download the file again or it will read from the cache. What are all the sequence of process it will take.
Another Q. comes to my mind immediately is, well if i change the image content but not the image name(myimage), If browser reads the cached image, the content of the image will not be identical with in my server. How to overcome this issue?
Not satisfied with the answer. Can some one tell me, What are all the sequence of process browser will do in these cases?
The browser will send a request for the image to the server even if it has it cached already (at least according to the network log in firebug). As far as I know, the server returns a “last downloaded/modified date” which can trigger a new download if too much time has passed (normally after 3 days or so the browser will redownload cached content).
The easiest way to overcome this is to add a version or release date to the filename so that the browser will ignore its cache.