How can I test that a java applet is loaded using javascript? -


the applet own, calling ready() returns "yes".

first tried embedding applet this:

        <object id="appletie"         classid="clsid:8ad9c840-044e-11d1-b3e9-00805f499d93"         width="100%" height="100%"         codebase="myapplet.jar">         <param name="archive" value="myapplet.jar" />         <param name="code" value="mypackage.myclass" />         <param name="myparam" value="my param value" />          <embed id="applet" mayscript=true         type="application/x-java-applet;version=1.6"         width="1px" height="1px"         archive="myapplet.jar"         code="mypackage.myclass"         pluginspage="http://java.com/download/">         </object> 

i tried check loaded javascript calling ready() on document.ready this: got error (typeerror: $(...).get(...).ready not function) assume tried call applet ready() function before loaded.

$(function(){   if (checkapplet() == false) {           $('#appletstatus').html('failed load applet.');       }    });      function checkapplet() {       return $('#applet').get(0).ready() == 'yes';   } 

then tried loading applet jquery this:

this worked little better, did not call applet ready() function until applet had loaded. once in while doesn't work, javascript becomes unresponsive, no error produced though applet seems loaded ok.

 $(function(){   var html = '';      if ($.browser.msie) {         html += '<object id="applet" ';         html += 'classid="clsid:8ad9c840-044e-11d1-b3e9-00805f499d93" ';         html += 'width="100%" height="100%" ';         html += 'codebase="myapplet.jar"> ';         html += '<param name="archive" value="myapplet.jar" /> ';         html += '<param name="code" value="mypackage.myclass" /> ';         html += '<param name="myparam" value="my param value" /> ';         html += '< /object>';     } else {         html += '<embed id="applet"';         html += 'type="application/x-java-applet;version=1.6"';         html += 'width="1px" height="1px" ';         html += 'archive="myapplet.jar"';         html += 'code="mypackage.myclass" ';         html += 'pluginspage="http://java.com/download/"';         html += 'myparam="my param value" />';         html += '</embed>';     }     $('#mydiv').append(html);  if (checkapplet() == false) {           $('#appletstatus').html('failed load applet.');       }   }); 

i'm looking suggestions on how can improve this, or other ways achieve solution.

as newer know when applet comes alive (the jvm must run, .jar downloaded , run , .ready() must connected browser), better strategy let applet tell browser when ready. may invoking js function named applet_ready() example.

see here how applet can invoke javascript functions: http://docs.oracle.com/javase/tutorial/deployment/applet/invokingjavascriptfromapplet.html


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -