Preload Images

Preload Image

H ave you ever opened a web page and the images take what it seems forever to load. If you have, you are not alone in this plight.

*      This script is not a guarantee nor is it written in stone. This is just a script that will hopefully preload the normal size images in a normal period of time before the image is called.

W e have tested the code in IE5.5, IE6.0, Firefox1.0, Opera7.54 and Netscape7.02. This script worked well in all platforms with no variations observed.

Get Firefox!

T his "Preload" script is placed in the <HEAD> section of your document.

<!---------- Start Preload Script ---------->

<SCRIPT LANGUAGE="javascript">

<!-- This script and many more are available free online at -->
<!-- The java.script Source!! http://javascript.internet.com ] -->

image1 = new Image();
image1.src = "Complete Path To Image To Preload";

image2 = new Image();
image2.src = "Complete Path To Image To Preload";

// End -->
</script>

<!---------- End Preload Script ---------->

T o add more images to be pre-loaded, just follow the format in the above script and be sure to number in sequence all the images to be preloaded. In other words, for each additional image, you need to add the below part of the script after the second image and before the below closing End tag.
// End -->

image3 = new Image();
image3.src = "Complete Path To Image To Preload";

I n other words if we wanted to add one more image to make it three (3) to the above code which is now set for two (2) images, it would look like the below.

<SCRIPT LANGUAGE="javascript">

<!-- This script and many more are available free online at -->
<!-- The java.script Source!! http://javascript.internet.com ] -->

image1 = new Image();
image1.src = "Complete Path To Image To Preload";

image2 = new Image();
image2.src = "Complete Path To Image To Preload";

image3 = new Image();
image3.src = "Complete Path To Image To Preload";

// End -->
</script>

Important Information!     In the above code, note it states "Complete Path To Image To Preload". What this means is that you "Do Not! use just the image name but the complete path.
  • Wrong Way: /myimage.gif
  • Right Way: http://www.mydomain.com/myimage.gif

Copyright © Consigliere Ltd., All Rights Reserved. 2001-