![]() |
Re: Java and Browsers (loading)
On Sat, 26 Jul 2003 15:42:41 -0500, Kent Feiler <kent@KentFeiler.com>
two-finger typed: > >A few observations and questions: > >(1) The time difference between Netscape loading an APPLET and IE >loading the same one is dramatic. I'm getting maybe 30 seconds for >Netscape and 1 second for IE. What's going on? Internet Explorer initializes the Java Virtual Machine during the boot-up process. So when the first applet is loaded it's pretty quick. Netscape doesn't initialize its JVM until the first Applet. After that, as long as you do not close all Netscape Navigator windows, any applets load just as quick. The same thing happens if you use the Java Plugin in Mozilla, Netscape or even Internet Explorer. (although I couldn't get the 1.4.2 Plugin working in IE 6.0 SP1 - it even disabled the internal MS JVM). > >(2) The Java code in the APPLET does appear to be cached. If you >change screens in Netscape and invoke the same APPLET the long initial >delay goes away. Once the JVM has been initialized, any other Applet loads quickly. >(3) But...the Javascript "onload" function doesn't seem to apply to >APPLETS. The "onload" is executed long before that APPLET is through >loading. It has nothing to do with the loading/retrieval of the Applet, only with the initial first use of the Java Virtual Machine. For IE that happens on boot, for netscape/mozilla/opera when the first applet is encountered (to save memory footprint in case no Java is used). >(4) Which brings up the question of how to determine when a Java >APPLET has finished loading and is is ready for business. (I'm >thinking of a status bar message saying, "Applet load in progress, >please wait.") Is there a standard way to do that? How about >including a function in the Java code that just returns, calling it, >and waiting for a response? You could override start() to do something: public void start() { showStatus("Applet started."); } Unfortunately the status field is not very 'stable' in combination with an Applet, once you hover over a link, the previous message is gone. You could make it better by catching the MouseListener events and refresh the status when a mouseEntered related event is sent (so when the mouse is over the Applet the status is reset to what the Applet wants it to be): public class MyApplet { public void init() { showStatus("Applet initializing..."); // ... other stuff addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent event) { if(event.getSource() == this) refreshStatus(); } }); } public void start() { showStatus("Applet started."); } String lastStatus = ""; public void showStatus(String line) { if(line == null) line = "" ; super.showStatus(lastStatus= line); } public void refreshStatus() { super.showStatus(lastStatus); } } > > >Regards, >Kent Feiler >kent@KentFeiler.com >www.KentFeiler.com Cheers. |
Re: Java and Browsers (loading)
Neomorph <neomorph@nospam.demon.co.uk> writes:
> Netscape doesn't initialize its JVM until the first Applet. After that, as > long as you do not close all Netscape Navigator windows, any applets load > just as quick. You can also add a command line option to Netscape to have it load the VM at startup, on Netscape 4 it was -start_java, dunnmo if the rewritten Mozilla codebase for Netscape 6 and later has something like that. |
| All times are GMT. The time now is 01:47 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.