Welcome to WebmasterWorld Guest from 23.20.184.141

Forum Moderators: open

Message Too Old, No Replies

Preload using js

     
2:29 am on Jun 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 25, 2000
posts:1786
votes: 0


Is there a way I can preload a class file and a zip file for a java applet on the next page using js on the current page?
7:28 am on June 28, 2001 (gmt 0)

Full Member

10+ Year Member

joined:May 16, 2001
posts:287
votes: 0


Would placing the java applet into a hidden layer on the previous page do the trick for you?
7:45 am on June 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


I don't know of a JavaScript technique, but here's another shot at a pure java one:

[tropo.com...]

3:02 pm on June 28, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 25, 2000
posts:1786
votes: 0


Cool. It was simpler than I made it out to be after all. I know most people don't like java applets but I have some that I think are extremely neat.
10:59 pm on June 28, 2001 (gmt 0)

Full Member

10+ Year Member

joined:Jan 31, 2001
posts:277
votes: 0


From the page tedster referenced above comes:

"And just for completeness, the standard HTML trick of preloading images is done via putting something like this:  

<img src="big.gif" width=1 height=1>

on a page before "big.gif" is needed - then when it is later loaded it will appear instantly as it will be in the browser image cache."

Well, that was not standard information for me and is a fantastic pickup for precisely what I need. Thank you.

11:30 pm on June 28, 2001 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 23, 2001
posts:402
votes: 0


Yep - good trick! Will be using that soon.
3:10 am on June 29, 2001 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


The 1x1 image pre-load has the benefit of being pure HTML rather than JavaScript. But the method has the downside of creating a dot on the page.

If you trust using JavaScript, you can get an invisible preload by including this at the very bottom your HTML code (so it doesn't slow down the loading for the visible page:

<script type="text/javascript" language="JavaScript">
<!--

big=new Image(width,height)
big.src="big.gif"

//-->
</script>

All this code does is cache the image for later use, the way you would do with a roll-over image, and nothing is visible until you want it to be.