简体   繁体   English

Applet可以打开新的HTML窗口并绕过弹出窗口阻止程序吗?

[英]Can Applet open a new HTML window *and* bypass popup blocker?

Our java applet needs to open a new htm page to web browser but popup blocker seem to block this code: 我们的Java Applet需要打开一个新的htm页面到Web浏览器,但是弹出窗口阻止程序似乎阻止了此代码:

  try
    {
      AppletContext a = getAppletContext();
      URL url = new URL(link);
      a.showDocument(url,"_blank");
    }

can you use somehow live javascript to open a window instead? 您可以使用某种方式的实时JavaScript打开窗口吗?

I'm probably not being helpful, but a popup blocker's task is to block popups. 我可能没有帮助,但是弹出窗口阻止程序的任务是阻止弹出窗口。 If there was a way to fool it, it would not be a good blocker after all. 如果有办法愚弄它,那终究不是一个好的阻挡者。

You will have to advise your users to disable the popup blocker to use your application. 您将必须建议您的用户禁用弹出窗口阻止程序以使用您的应用程序。

AppletContext show document is implemented by doing the JavaScript call. AppletContext显示文档是通过执行JavaScript调用实现的。 However, the context the popup blocker is using will probably be absent. 但是,弹出窗口阻止程序正在使用的上下文可能会不存在。 If the click happens outside of an applet you can use only JavaScript to open the popup, but using a URL supplied by the applet (so the applet never has to call out to JavaScript). 如果单击发生在applet之外,则只能使用JavaScript打开弹出窗口,而只能使用applet提供的URL(因此applet不必调用JavaScript)。

I am fairly sure that any popup blocker worth its salt will block popups. 我相当确定任何值得盐分的弹出窗口阻止程序都将阻止弹出窗口。 No matter what you put on your page, there are very few ways to actually spawn a new window, and all of these will almost certainly be covered. 不管您在页面上放置什么内容,实际生成新窗口的方法都很少,几乎可以肯定所有这些方法都将被涵盖。

So think about if you really need to spawn a popup window in an environment where the client is likely to have these installed. 因此,请考虑是否真的需要在客户端可能已安装了弹出窗口的环境中生成弹出窗口。 If it's a legitimate purpose it may not be unreasonable to ask the client to whitelist your site in their popup blocker. 如果这是出于合法目的,则要求客户在其弹出窗口阻止程序中将您的网站列入白名单可能并非不合理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM