The window opened by window.open
will always be regarded as a pop-up to block by browsers when the function is triggered without a user action initiating it.
That means that for example that these will not be blocked:
$('a').on('click.open', function(e) { e.preventDefault(); window.open('http://disney.com') });
Chrome even allows other events to trigger the popup, while firefox will not allow this:
$(document).on('keydown', function(e) { window.open('http://stackexchange.com') });
And this will be blocked:
$(document).ready(function() { window.open('http://stackoverflow.com') });
So, unless you're triggering the window.open
after a user action, you can never be sure that your window won't be blocked.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…