javascript - Open multiple tabs in Chrome via bookmarklet - Stack Overflow

I'm making bookmarklets for my personal use, and some of them should open 2-3 tabs at once. But cu

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);

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);
Share Improve this question edited Jan 5, 2013 at 16:32 Nakilon asked Jan 5, 2013 at 16:04 NakilonNakilon 35.1k16 gold badges111 silver badges148 bronze badges 2
  • 1 Did you try setting a timer, say 10msec, so they appear to be separate opens. – user1637281 Commented Jan 5, 2013 at 16:06
  • @pure_code, finally I've got timeouts to work, thanks, that was it. – Nakilon Commented Jan 5, 2013 at 16:25
Add a ment  | 

2 Answers 2

Reset to default 4

They both open at the same(or close to) time with that code, change the delay or embed one in the other.


    setTimeout( function(){ window.open(url1) }, 10);
    setTimeout( function(){ window.open(url2) }, 20);
    setTimeout( function(){ /* any other code with window.open() */ }, 30);

Chrome runs each tab as a separate sandboxed process - when you click a bookmark, it can only take action within that tab.

That leaves you with the option of opening the second tab from the html/js of the first, but this will be blocked by the popup blocker unless it is prompted by a user action.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742339304a4425294.html

相关推荐

  • javascript - Open multiple tabs in Chrome via bookmarklet - Stack Overflow

    I'm making bookmarklets for my personal use, and some of them should open 2-3 tabs at once. But cu

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信