Forum Moderators: not2easy

Message Too Old, No Replies

Here's the Problem

A simple preload script?

         

jk321

9:03 pm on Mar 4, 2001 (gmt 0)



I have an on-going segment on my site that amounts to 20-30 separate pages, each with 1 picture on it. Pages are navigated by simple text links. (Back, Home, Next) The segment changes every week. (i.e. there is another NEW 20-30 page segment added each week that doesn't replace the old one)

What's the simlpest js I could add to the first page that would pre-load the remaining images while people are viewing the first page?

(I've been leary of the "slideshow" javascripts I've seen so far because each image is always a different size, and changing the script for differing sizes each week looks to be more trouble than it's worth)

Thanks,
jk321

tedster

9:48 pm on Mar 4, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's one way. At the very bottom of the HTML code for each page include:


<script language="JavaScript">
<!--

nextslide=new Image()
nextslide.src="filename.ext"

//-->
</script>

This invisibly downloads the image "filename.ext" to the cache. It goes at the very end of the HTML so that it doesn't compete with the download of the page that is currently displayed.

jk321

3:02 am on Mar 5, 2001 (gmt 0)



It works!