简体   繁体   English

一键弹出多个弹出窗口,如皮划艇Javascript

[英]Multiple Popups With One Click like kayak Javascript

I has to develop for a client a function to open multiple popups of information in just one click. 我必须为客户开发一个功能,只需单击一下即可打开多个信息弹出窗口。

I create a function like this: 我创建一个像这样的函数:

<script>
var index = 0 ;
function openWindows()
{
    var url = new Array() ;
    url[0] = "http://www.marca.com" ;
    url[1] = "http://www.google.es" ;
    for(i=0; i < url.length ; i++)
    {
        window.open(url[index],"ident_"+index) ;
        index = index + 1 ;
    }
    index = 0 ;
}
</script>

I call this function with the next code 我用下一个代码调用此函数

<a href="javascript:openWindows()">Open Popups</a>

This function runs perfectly on Firefox, but on Chrome and Internet Explorer i get the second popup blocked ( the first one opens perfectly ) 该功能可以在Firefox上完美运行,但是在Chrome和Internet Explorer上,我会阻止第二个弹出窗口(第一个弹出窗口可以完美打开)

I dont know how to do it.At first, i thought that it was not possible, but then, i see a website ( http://www.kayak.es/ ) where you choose how many sites do u want to compare with kayak and he opens all the selected sites in Popups with one click. 我不知道该怎么做。起初,我认为这是不可能的,但是随后,我看到一个网站( http://www.kayak.es/ ),您可以在其中选择要与多少个网站进行比较划独木舟,他一键打开了Popups中所有选定的站点。

Someone knows how to do it? 有人知道该怎么做吗?

The code is correct. 代码正确。 Try to check your security settings in Chrome and IE, they are blocking multiple popups in some way. 尝试在Chrome和IE中检查您的安全设置,它们以某种方式阻止了多个弹出窗口。

Try passing to the second popup a parameter to tell him to open the next popup and so on. 尝试将一个参数传递给第二个弹出窗口,告诉他打开下一个弹出窗口,依此类推。 Maybe the browser check to opener window to block multiple popups. 也许浏览器检查打开窗口以阻止多个弹出窗口。 Or try to put some microtime-sleep between each opening. 或者尝试在每个开口之间放置一些microtime-sleep。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM