Re: Java and Browsers (loading)

Discussion in 'Java' started by Neomorph, Jul 27, 2003.

  1. Neomorph

    Neomorph Guest

    On Sat, 26 Jul 2003 15:42:41 -0500, Kent Feiler <>
    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

    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)
    public void start() {
    showStatus("Applet started.");

    String lastStatus = "";
    public void showStatus(String line) {
    if(line == null) line = "" ;
    super.showStatus(lastStatus= line);
    public void refreshStatus() {

    >Kent Feiler

    Neomorph, Jul 27, 2003
    1. Advertisements

  2. Neomorph <> 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
    Tor Iver Wilhelmsen, Jul 28, 2003
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Grant Wagner

    Re: Java and Browsers (loading)

    Grant Wagner, Jul 28, 2003, in forum: Java
    Grant Wagner
    Jul 28, 2003
  2. Andries
    Sean Jorden
    Sep 9, 2003
  3. El Kabong

    Browsers, browsers! Quo vadis?

    El Kabong, May 11, 2007, in forum: HTML
    May 13, 2007
  4. Jacques Oberto

    AJAX Page Loading Failure on Some Browsers

    Jacques Oberto, Oct 21, 2009, in forum: ASP .Net
    Jacques Oberto
    Oct 22, 2009
  5. Graham J
    Graham J
    Sep 20, 2003

Share This Page