6

I'm making bookmarklets for my personal use, and some of them should open 2-3 tabs at once. But currently Chrome dissalows to open multilple tabs with one click, blocking the second, third and the rest of window.opens which I'm trying to execute.

I understand, that it's something about security and avoiding of eternal loops, but I need to open windows in just one iteration. I would like to make Chrome sure, that everything going to be fine and stop that annoying blocking, because extra clicks for allowing pop-ups on each website, while their number isn't limited, makes my bookmarklets not so useful at all.

Already tried this:

setTimeout(function(){window.open(url1)}, 500);
setTimeout(function(){window.open(url2)}, 500);
4

2 回答 2

3

它们都与该代码同时(或接近)打开,更改延迟或将一个嵌入另一个。


    setTimeout( function(){ window.open(url1) }, 10);
    setTimeout( function(){ window.open(url2) }, 20);
    setTimeout( function(){ /* any other code with window.open() */ }, 30);
于 2013-01-05T16:28:03.793 回答
1

Chrome 将每个选项卡作为单独的沙盒进程运行 - 当您单击书签时,它只能在该选项卡内执行操作。

这使您可以选择从第一个选项卡的 html/js 打开第二个选项卡,但这将被弹出窗口阻止程序阻止,除非用户操作提示它。

于 2013-01-05T16:07:28.343 回答