If you’re not familiar with the idea of a cache, allow me to explain. Every webpage and its contents you view gets saved in a special part of your hard disk called a cache (pronounced cash). The next time you visit that page the images are taken from the cache instead of being downloaded again. This means they appear faster and make way for new things that may have to be downloaded for the first time. You may have had a run through your ‘Temporary Internet Files‘ folder in Windows — that’s Internet Explorer’s cache. Netscape keeps its cache in its program folder.
So, on your first visit you have to download a load of stuff, but on every visit thereafter you’re just pulling stuff up from the cache. This is also how it’s possible to read websites offline; they’re just being read off your hard drive.
The idea of pre-loading images is to load them and put them in the cache before they’re even needed. This means that when they are called for they’ll appear almost immediately. This property is most important with things like navigation graphics and image rollovers. You can guess what images your reader might need and load them in advance, in the background so they’ll never see it happen.
Image1= new Image(150,20)
Image1.src = “pic1.gif”
Image2 = new Image(10,30)
Image2.src = “pic2.gif”
Image3 = new Image(72,125)
Image3.src = “pic3.gif”
// End Hiding –>
That script would pre-load images 1 to 3. If you’ve used image flips before you can see that that code has a pre-load built into it. If you’ve never seen one of these run before, here’s what it all means:
Image1= new Imageis the first step of setting up a new script effect for an image
(150,20)are the width and height, respectively, of this image
Image1.src = "pic1.gif"gives the source of the image.
Place the script near the top of your page, in the
head if you want. This will ensure it runs early as the page loads.
Online Script Generator for Preloading Images