From: Miguel <mi...@jm...> - 2004-06-19 08:11:28
|
Paul wrote: > Working on a javascript library for jmol, I discovered a bug specific > to mozilla (I use firefox 0.8 for windows), with the messageCallback > method > : > if mayscript is set in the applet tag as in > > [applet name="jmol" code="JmolApplet" > archive="JmolApplet.jar" width="500" height="500" > mayscript="true"] > > then the messagecallback method is able to work. Yes ... 'mayscript' should always be used in this manner ... as an attribute to the applet tag. > But, if mayscript is set in the param tag as in > > [applet name="jmol" code="JmolApplet" > archive="JmolApplet.jar" width="500" height="500"] > [param name="mayscript" value="true"] > > then, the messagecallback method will not work ! > (same for pickcallback) > This issue is not found with IE 6.0 (using the Java plugin), nor in > Netscape 4.7. I am puzzled that this didn't work with firefox. If I recall correctly, the current Java Plug-in documentation says that bi-directional communications between Java & JavaScript are enabled by default. firefox must be doing some additional checking. And I am somewhat surprised that it worked OK on Netscape 4.7 with mayscript defined as a param rather than as an attribute. More Detail ----------- The way that the attributes are handled for applets is a little complicated. At some level, one needs to make a distinction between the parameters to the browser and the parameters to the underlying applet. The attributes to the the [applet ...] tag are generally directed to the browser/jvm. The [param ...] values are generally directed to the underlying applet itself. mayscript is essentially requesting that the applet be given permission to talk to JavaScript ... to make JavaScript calls that could change the browser behavior. Therefore, you need to send this to the brower/jvm, not to the applet. mayscript is not needed to make calls from JavaScript to Java applets. It is only needed if you want toe allow the applet to make calls to JavaScript. The thinking was that this was a more dangerous operation, because an unknown applet could start doing things to your browser. In fact, as they added more power to JavaScript people figured out how to do all these things using pure JavaScript without the applets ... annoying popup windows, hijacking your web browser and taking it to 'adult entertainment' websites, etc. A few more facts (if I recall correctly) about mayscript that make it strange: * the HTML specification does not mention it as a valid attribute * we need it for Netscape 4.* * the parameter used to be just 'mayscript', without giving it a value. But that tends to break current HTML/XML rules. So we say mayscript='true' to try to keep html validation tools happy. * I don't think it is needed at all for the Java Plug-in under IE. The Java Plug-in documentation says that bi-directional communications between JavaScript and Java Applets are enabled by default. Miguel |