When using the Java Plug-in, how can I communicate with JavaScript from my applet?

Larry Widing

According to Sun's documentation (at least for the 1.3 version of the plug-in), you can communicate with JavaScript using the JSObject classes. The difference is in how you tell the JVM that you want to use that support.

For IE, using the <OBJECT> tag, you need to add the following parameters:

<PARAM NAME="scriptable" VALUE="true">

<PARAM NAME="mayscript" VALUE="true">

These parameters will tell the plug-in that your applet can be called by JavaScript, and can call back to the JavaScript.

In Netscape, the above needs to be specified as attributes to the EMBED tag:

<EMBED ... scriptable="true" mayscript="true" ...>

More details can be found on Sun's site in the articles How Java to JavaScript Communication Works in Java Plug-in and Java Plug-in HTML Specification".

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact