从 Java Applet 调用 JavaScript 函数的最佳方法

发布于 2025-01-02 03:52:23 字数 333 浏览 1 评论 0原文

我使用 JSNI 将方法导出到 javascript 窗口,并且我想从 GWT 应用程序中的小程序调用此函数。

我认为有时我在 Window 上下文方面遇到问题,所以,我做了一些研究并找到了 JSObject类。

我担心包名称(netscape.javascript)。这个类还可以用吗?还有其他更好的方法吗?

我已经尝试获取小程序上下文并显示新的 URl(使用 javascript:myFunction();),但是,在某些浏览器中,它将用户重定向到新的空白窗口...

我能做什么使其尽可能发挥最佳作用?

提前致谢。

I export a method to javascript window with JSNI, and I want to call this function from a applet in a GWT application..

I think that sometimes I have problems with Window context, so, I do some research and found the JSObject class.

I afraid with the package name (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...

What can I do to make it works best as possible?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江城子 2025-01-09 03:52:23

据我所知,每个 Oracle JRE 都包含 netscape.javascript 包。不完全确定其他人。

The netscape.javascript package is included with every Oracle JRE that I am aware of. Not entirely sure about the others.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文