问题
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:
- Ask your users to turn off their popup blocker (not nice).
- Change your scripts to work in response to a link or button click.
- Use fake windows such as a jQuery UI dialog.
来源:https://stackoverflow.com/questions/9616150/window-open-getting-blocked-in-some-browsers