[英]Best way to call a JavaScript function from an Java Applet
I export a method to javascript window with JSNI, and I want to call this function from a applet in a GWT application.. 我使用JSNI将方法导出到javascript窗口,我想从GWT应用程序中的applet调用此函数。
I think that sometimes I have problems with Window context, so, I do some research and found the JSObject
class. 我认为有时Window上下文存在问题,因此,我进行了一些研究,找到了
JSObject
类。
I afraid with the package name ( netscape.javascript
). 恐怕要加上包名(
netscape.javascript
)。 Is this class still be used? 仍然使用此类吗? Is there another better way to do this?
还有另一种更好的方法吗?
I already tried to get applet context and show a new URl (with javascript:myFunction();
), but, in some browsers it redirects the user to a new blank window... 我已经尝试获取applet上下文并显示一个新的URl(使用
javascript:myFunction();
),但是,在某些浏览器中,它会将用户重定向到新的空白窗口...
What can I do to make it works best as possible? 我该怎么做才能使其发挥最佳作用?
Thanks in advance. 提前致谢。
The netscape.javascript
package is included with every Oracle JRE that I am aware of. 我知道,每个Oracle JRE都包含
netscape.javascript
软件包。 Not entirely sure about the others. 不完全确定其他人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.