javascriptjavaappletliveconnect

Java 8 Update 91 Issue


While applet initializing when using isActive() method. It only return undefined. This problem only comes "Java 8 Update 91". Can anyone tel me the solution to fine applet loaded or not?

I have used the following code:

function isAppletActive(app) {
 var active = false; 
 try { active = app.isActive(); // IE check }
 catch(ex) { 
 try { active = app.isActive; // Firefox check }
   catch(ex1){ } } //alert(active); return active; 
}

Solution

  • This is a bug in either Firefox (most likely) or Java 8_91. It appears that any premature call to the applet's method hoses the link to the applet permanently.

    However, the applet support has a new feature for checking applet status, enabled by setting parameter <param name="java_status_events" value="true"/>. This in turn allows status to be checked while the applet is loading. If you enable this, and use it to prevent any applet method being called until the applet loads, it all works.

    function isAppletActive(app) {
        // assuming `app` is the applet element...
        if(app.status==1) { return false; } // still loading
        if(app.status==2) { throw "Applet load failed"; }
    
        try { active = app.isActive(); } // IE check 
        catch(ex) { 
            try { active = app.isActive; } // Firefox check 
            catch(ex1) { /* NEVER swallow exceptions! */ } 
        } 
        //alert(active); 
        return active;
    }
    

    And just BTW, Firefox uses app.isActive(), not app.isActive, though who knows what it did in the past.