'window.open'被Firefox阻止 [英] 'window.open' blocked by Firefox

查看:230
本文介绍了'window.open'被Firefox阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 window.open 并在文档 ready 事件中调用它,但是它被弹出窗口阻止阻止在Firefox。然后我把这个添加到函数,并从一个按钮调用这个函数,然后触发按钮点击没有成功:

  $(function(){
abcd();
});


函数abcd(){
var popup = window.open(http://localhost/johndyer-mediaelement-7ed6c51/demo/index.php,mypopup , 宽度= 500,高度= 300);
}

有没有办法在浏览器上打开一个外部弹出窗口或新选项卡该页面加载?

解决方案

不要打开弹出广告。这很烦人。另一方面,如果用户希望看到的消息,那么你可以使用 jQuery 插件,例如 Colorbox 显示一个悬停的模式窗口,不用打开一个新的弹出窗口,用户可以轻松关闭。


I use window.open and call it at the document ready event, but it is blocked by a popup blocker in Firefox. Then I added this to the function and make a call of this function from a button and then trigger the button click without success:

$(function(){    
    abcd();    
});


function abcd(){
    var popup = window.open("http://localhost/johndyer-mediaelement-7ed6c51/demo/index.php","mypopup","width=500,height=300");       
 }

Is there some way to open an external popup window or new tab on browser when the page loaded?

解决方案

Don't open pop up advertising. It's annoying.

On the other hand, if it's a message the user wants to see, then you can use a jQuery plugin like Colorbox to display a hovering modal window without opening a new popup, that the user can easily close.

这篇关于'window.open'被Firefox阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆