window.open(…) getting blocked in some browsers

我的梦境 提交于 2019-12-23 04:33:42

问题


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. 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')

回答1:


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.


来源:https://stackoverflow.com/questions/9616150/window-open-getting-blocked-in-some-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!