pre-loading images for performance
How can I pre-load an image into the cache so that it is immediately ready when I need it?
Pre-loading an image is useful in the following situations:
Pre-loading an image requires a simple, two-step process:
The document contains images that change while the document is being displayed (for example, link buttons that change when the mouse passes over them). To avoid animation delays, the new images should be loaded before they are required.
You are reasonably sure that the image will appear in the next document the user loads. For example, if your web site has a "splash page," you can increase the client browser's performance (and thus the client's satisfaction with your page) by pre-loading the images from the next page.
- Create an image object using the
- Set the image object's src property equal to the image's URL. This causes the browser to begin loading the image.
More information on the
nextimage = new Image ();
nextimage . src = "nextimage.gif";
11 Jan. 1997