Entry
Why Java to JavaScript communication fails
Aug 20th, 2000 12:39
Klaus D. Witzel, Barak Naveh, http://java.sun.com/products/plugin/1.2/docs/jsobject.html
I hope you mean by this: Java applet to JavaScript communication, both
usually in the same Web page or FrameSet.
No, there is no reason this communication should _not_ work (except for
bugs introduced by the java vendors ;-)
In your java applet code, import netscape.javascript.*;
Then, in some of the java applet methods you override, you can access
JavaScript by
JSObject jsWindow=JSObject.getWindow(this);
Suppose in your Web page you have a JavaScript
function test(argv){return argv+'more';}
then from inside you java applet you do
String result=(String)jsWindow.call("test",new String[]{"gimme "});
/Klaus