简体   繁体   English

window.open(...) 在某些浏览器中被阻止

[英]window.open(…) getting blocked in some browsers

I have a script where it opens a window for online application after executing some other scripts.我有一个脚本,它在执行其他一些脚本后打开一个用于在线应用程序的窗口。

window.open() is not called on any click. window.open()不会在任何点击时调用。 It is getting called in a script and browser prevents the new window from appearing.它在脚本中被调用,浏览器会阻止新窗口出现。

How to overcome this?如何克服这一点?

Here is the code:这是代码:

window.open('/search/applyonline?jobid=".$jobDetails->getIdjob()."', 
            'applyurljob',
            'height=550,\ 
             width=800,\
             toolbar=no,\
             directories=no,\
             status=no,\
             menubar=no,\
             scrollbars=yes,\
             resizable=yes,\
             left=200,\
             top=250')

Popup blockers will block windows from being opened that are not in response to a click event.弹出窗口阻止程序将阻止打开未响应单击事件的窗口。 Therefore you can:因此,您可以:

  1. Ask your users to turn off their popup blocker (not nice).要求您的用户关闭他们的弹出窗口阻止程序(不好)。
  2. Change your scripts to work in response to a link or button click.更改您的脚本以响应链接或按钮单击。
  3. Use fake windows such as a jQuery UI dialog .使用伪窗口,例如jQuery UI 对话框

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

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