Images loaded with jQuery, aren't saved in the Google Chrome's cache? It downloads from the server every time.
THE SITUATION: I'm using jQuery slimbox2 to load a picture in a 'lightbox'. Nothing special at this point. I added some jQuery code that detects when the mouse cursor goes over the lightbox image: when this happens, I load dynamically a version of the lightbox picture, but bigger (like a zoom) by changing the css background of a div.
THE PROBLEM: When the cursor goes in the lightbox for first time, it's supposed to load the 'big' image, and with all browsers the image keeps in cache, so when the cursor goes out, and in for 2nd time, the 'big' image it's already downloaded, so it doesn't take that split second or 1 second to download.
With Chrome it downloads again and again, every time. (There are even more problems, because the mousein mouseout event of the lightbox pagination layers make this extra download = image flicking all the time [image download]).
THE EXAMPLE: My English is quite brutal and it's late. Just check the example to understand :) http://motocross.es/f/oneal/casco-oneal-7-series-mayhem-roots/996
Thanks in advance, and forgive my English level.
try to store them into the local store ibm.com localstorage example
I believe this is because the headers sent with your image don't say anything about its caching. By which I mean that your image URL:
http://motocross.es/ajax/shop.ajax.original_pic.php?file=ref_44_1szyh6a9s5mh3ixc.jpg
...serves the image with these headers:
Which say nothing about how the image should be cached. Compare that with, for example, the basic, smaller image on the main page:
http://motocross.es/upload/shop/vendedores/44/productos/standard/cropped_ref_44_1szyh6a9s5mh3ixc.jpg
...where the headers look like this:
See the extra caching instructions? There's a
Cache-Control
header there, which is probably the important bit, as well as other caching information like an ETag. There's also aContent-Type
, which might be relevant, as it's possible a browser's caching strategy might be related to content type in the absence of other clues.Are you yourself sending back the image from the server when the URL:
http://motocross.es/ajax/shop.ajax.original_pic.php?file=ref_44_1szyh6a9s5mh3ixc.jpg
...gets hit? i.e. is the server end your code as well? If so, try adding an appropriate
Cache-Control
header and aContent-Type
. If you control the server, it's pretty much up to you how your images are cached by the browser.