• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem calling javascript from an applet in NS 6

 
Jeff Pierce
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to get my applet to call a Javascript function from within NS6. It works in IE. I am using the OBJECT/EMBED tags. (note: works also in Communicator with APPLET tag).
I am getting a JSObject exception upon my first call to JSObject.getWindow(this). I did discover if I put mayscript in uppercase, the above call would return "null" so I think I am getting farther.
I am also using dynamic class loading in my applet but I have tried both. I don't have a java40.jar file with the JS classes in them other than the one from Communicator 4.7. I have also tried using the java40.jar in my applet build with NS 6 without luck.
Here's my tags:
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<!-- TAGS COMMENTED OUT FOR POSTING -->
<!--
<OBJECT classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA"
WIDTH = "500" HEIGHT = "200" NAME = "CommandApplet" codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0">
<PARAM NAME = CODE VALUE = "MyCommandApplet.class" >
<PARAM NAME = mayscript VALUE = true >
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
<PARAM NAME="scriptable" VALUE="true">
<COMMENT>
<EMBED type="application/x-java-applet;jpi-version=1.3.1"
CODE = "MyCommandApplet.class"
NAME = "CommandApplet"
WIDTH = "500" HEIGHT = "200"
maystript=true
scriptable=true
pluginspage="http://java.sun.com/products/plugin/1.3.1/plugin-install.html">
<NOEMBED>
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
-->
<!--"END_CONVERTED_APPLET"-->
Here's my applet snippet:
<!--
public void showDialog() {
// called from a button on the applet this is loaded.
System.out.println(">>> showDialog()");
try {
JSObject jsRoot = JSObject.getWindow(this); // throws exception in NS6
// ... MORE STUFF HERE
System.out.println("Success!");
}
catch(Exception ex){
System.out.println("Exception!");
}
System.out.println("<<< showDialog()");
}
-->
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic