为什么我的 Google Chrome 扩展程序只能打开更多选项卡中的 25 个? [英] Why does my Google Chrome extension only open 25 tabs out of many more?

查看:30
本文介绍了为什么我的 Google Chrome 扩展程序只能打开更多选项卡中的 25 个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一段代码,只是不想作为 Chrome 扩展正常工作.

据我所知,一切正常,除了它在标签 25 附近停止打开页面,无论应该打开多少标签.我检查了代码,它尝试正确打开每个链接,但实际上并没有.有什么想法吗?

for (x = 0; x<55; x++){窗口.打开();}

解决方案

有一个故意上限 window.open 调用为 25.请参阅 Chromium 错误 26323382 作为背景,但简而言之,这个想法是为了防止拒绝服务(两个 UI-wise 和 memory-wise) 来自无限期打开弹出窗口的页面的攻击.<​​/p>

chrome.tabs.create 这样的扩展 API(正如 PAEz 的回答所暗示的那样)不受这些 API 的约束,因为扩展已经是特权访问了.

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 pages around tab 25, no matter how many tabs should be opened. I checked the code and it attempts to open every single link properly, but in reality it doesn't. Any ideas?

for (x = 0; x<55; x++){
   window.open();
}

解决方案

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.

这篇关于为什么我的 Google Chrome 扩展程序只能打开更多选项卡中的 25 个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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