Click to See Complete Forum and Search --> : precaching stuff


Wozza
08-04-2003, 09:12 AM
For some reason, I was sure I knew how to do this. I must be going insane.

Basically, I just want a page to cause a user to download (to the cache) a whole bunch of images that will then be used throughout the pages they visit. But I don't want to display these images as they download, if you know what I mean. Would this be done with Javascript? And if so, how would I go about it?

Cheers-
Wozza

rdoekes
08-04-2003, 10:41 AM
say you want to preload 3 images :
images/1.jpg, images/2.jpg, images3.jpg


var image1 = new Image();
image1.src = "images/1.jpg";
var image2 = new Image();
image2.src = "images/4.jpg";
var image3 = new Image();
image3.src = "images/3.jpg";

this will cause the images to preload if you place this script in the header section of your html

now you can access those images in the body with:
<img src="javascript:image1.src"> etc..

Wozza
08-04-2003, 06:01 PM
Thank you kindly =)

-Wozza