Will an image with style="display: none" still be downloaded and cached?

caching, css, html, javascript

Solution

`display: none` images will be downloaded and cached on the client. However, JavaScript already has a well-defined way of preloading images:

  var nextImage = new Image();
  nextImage.src = "your-url/newImage.gif";

This will preload an image without displaying it to the user.

Problem

I'm trying to figure out a way to cache the next and previous images in my gallery script ... I'm wondering if this is a good way to do it. Also, is there any way to manually specify the cache time for the downloaded image?

Original source