Detect if an Applet is readyTag(s): Javascript interaction

function isAppletReady(a) {
   return a.isActive();

<INPUT TYPE=button 
   VALUE="Check applet" 
   onClick="if (!isAppletReady(document.applets[0])) alert("not ready");">
An Applet is ready when it's loaded and its init() method is done.

To execute a Javascript only when an Applet is ready :

function waituntilok() {
   if (document.myApplet.isActive()) {
   else {

function doit() {
<BODY onLoad="waituntilok();">


By calling the javascript function from the BODY onLoad handler, we can assume that the Applet is loaded, initiated and started.

Here a "browser friendly" solution from N. Witteman to check if an Applet can be loaded (or found).


onError = errHandler;  
  // Without he parentheses, because we don't want IE
  // to do this. Like this, only NS does.

function appLoaded() {
 if (!document.applets[0].isActive)
    // in IE: isActive returns an error if the applet IS loaded, 
    // false if not loaded
    // in NS: isActive returns true if loaded, an error if not loaded, 
    // so never reaches the next statement
    alert("IE: Applet could not be loaded");

function errHandler() {
 alert("NS: Applet could not be loaded");
 // stops further processing of the error


<BODY onLoad = appLoaded();>
<APPLET code=someClass.class
codeBase=someURL height=50 width=300><PARAM NAME="bgcolor" VALUE="FFFFFF">

blog comments powered by Disqus