Re: Java and Browsers (loading)

Discussion in 'Java' started by Grant Wagner, Jul 28, 2003.

  1. Grant Wagner

    Grant Wagner Guest

    Kent Feiler wrote:

    > 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?
    >
    > (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.
    >
    > (3) But...the Javascript "onload" function doesn't seem to apply to
    > APPLETS. The "onload" is executed long before that APPLET is through
    > loading.
    >
    > (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?
    >
    > Regards,
    >
    > Regards,
    >
    > Kent Feiler
    >
    > www.KentFeiler.com


    In our Intranet environment, I was able to get away with the following
    code:

    <body onload="window.appletsLoaded=false;checkApplets();">
    <script type="text/javascript">
    function checkApplets() {
    var timerId;
    var applets = document.applets;
    var appletsLoaded = true;
    for (var i = 0; i < applets.length; i++) {
    if (!applets.isActive()) {
    appletsLoaded = false;
    timerId = setTimeout('checkApplets()', 200);
    break;
    }
    }

    if (appletsLoaded) {
    clearTimeout(timerId);
    window.appletsLoaded = true;
    }
    } // checkApplets()
    </script>

    Then my other client-side code tests window.appletsLoaded before
    attempting to execute any LiveConnect which depends on the applets being
    started. Unfortunately, the above code doesn't work in Mozilla, at least
    it didn't as of version 1.3. I haven't tested it recently because Mozilla
    supportisn't a requirement (yet).

    Anyway, the important bit here is that from client-side JavaScript, you
    should be able to invoke isActive() on an applet in any browser that
    supports LiveConnect (Netscape 4.78 and IE for example) and determine
    whether the applet is started.

    From documentation I found:

    public abstract boolean isActive()

    Determines if the applet is active. An applet is active just before its
    start method is called. It becomes inactive immediately after its stop
    method is called.

    Returns: true if the applet is active; false otherwise.

    --
    | Grant Wagner <>
     
    Grant Wagner, Jul 28, 2003
    #1
    1. Advertising

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. Neomorph

    Re: Java and Browsers (loading)

    Neomorph, Jul 27, 2003, in forum: Java
    Replies:
    1
    Views:
    425
    Tor Iver Wilhelmsen
    Jul 28, 2003
  2. Andries
    Replies:
    5
    Views:
    4,467
    Sean Jorden
    Sep 9, 2003
  3. El Kabong

    Browsers, browsers! Quo vadis?

    El Kabong, May 11, 2007, in forum: HTML
    Replies:
    23
    Views:
    907
    dorayme
    May 13, 2007
  4. Jacques Oberto

    AJAX Page Loading Failure on Some Browsers

    Jacques Oberto, Oct 21, 2009, in forum: ASP .Net
    Replies:
    2
    Views:
    979
    Jacques Oberto
    Oct 22, 2009
  5. Graham J
    Replies:
    2
    Views:
    110
    Graham J
    Sep 20, 2003
Loading...

Share This Page