如何在一定时间后自动打开弹出窗口(不阻塞) [英] How to open popups automatically after certain time (without blocking)

查看:123
本文介绍了如何在一定时间后自动打开弹出窗口(不阻塞)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个网页,我必须在8秒(8000毫秒)后从一个按钮打开一个弹出窗口。

我想在一个之前放一些延迟(8秒)弹出窗口自动打开。





我的问题是mozilla firefox阻止了我的弹出窗口



这是我的代码:





< html>

< head>

< script>

函数调用()

{

popup = window。开放( 'http://www.google.co.in');

}

函数调用者()

{

setInterval(call,8000);

}

< / script>

< / head>



< body>

< input type =buttonönclick=caller();>

< / body>

< / html>

I am making a web page, in which I have to open a popup window from an buton after 8 seconds(8000 ms).
I want to put some delay(8 seconds) before a popup open automatically.


my problem is that mozilla firefox block my popup

Here is my code:


<html>
<head>
<script>
function call()
{
popup = window.open('http://www.google.co.in');
}
function caller()
{
setInterval(call, 8000);
}
</script>
</head>

<body>
<input type="button" önclick="caller();">
</body>
</html>

推荐答案

解决此问题最方便的方法是实现 jQuery Dialog [ ^ ]。
The most convenient way to tackle this problem is to implement jQuery Dialog[^].


只能自动打开您自己托管的页面。如果要自动打开其他站点,则需要将其设置为受信任。安全机制不仅在FireFox中实现,还在Chrome和IE中实现。
Only the pages hosted by yourself can be opened automatically. If you want to open other sites automatically, you need to set them trusted. The security mechanism is not only implemented in FireFox, but also Chrome and IE.


这篇关于如何在一定时间后自动打开弹出窗口(不阻塞)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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