Why does my Google Chrome extension only open 25 tabs out of many more?

后端 未结 2 1906
萌比男神i
萌比男神i 2020-12-07 02:11

I have a piece of code here that just doesn\'t want to work right as a Chrome Extension.

As far as I can tell, everything works perfectly, except it stops opening p

相关标签:
2条回答
  • 2020-12-07 02:48

    Probably something to do with a popup blocker or what Brad said.
    Its easy enough to deal with tho, just use the tabs api....

    for (x = 0; x<55; x++){
       chrome.tabs.create({url:"nowhere"+x});
    }
    

    ...55 tiny tabs ;)

    0 讨论(0)
  • 2020-12-07 03:11

    There is an intentional upper bound of 25 on window.open calls. See Chromium bugs 2632 and 3382 for background, but in brief, the idea is to prevent denial-of-service (both UI-wise and memory-wise) attacks from pages that open popups indefinitely.

    Extension APIs like chrome.tabs.create (as PAEz's answer suggests) are not subject to these APIs, since extensions are privileged access already.

    0 讨论(0)
提交回复
热议问题