file - 隐身访问扩展文件

标签 file google-chrome-extension incognito-mode

我需要扩展程序才能在扩展程序目录中的页面上打开一个选项卡(类似于“chrome-extension://myExtensionID/subfolder/index.html”)。在正常模式下它可以工作,但在隐身模式下 chrome 显示“此网页不可用”。

我该如何解决? list 文件上有什么要写的吗?谢谢:)

最佳答案

您需要添加 "incognito":"split" list 文件的选项。

来自文档:

incognito

Either "spanning" or "split", to specify how this extension will behave if allowed to run in incognito mode.

The default for extensions is "spanning", which means that the extension will run in a single shared process. Any events or messages from an incognito tab will be sent to the shared process, with an incognito flag indicating where it came from. Because incognito tabs cannot use this shared process, an extension using the "spanning" incognito mode will not be able to load pages from its extension package into the main frame of an incognito tab.

尽管如此,请仔细测试您的扩展程序。 “拆分”隐身模式在 Chrome 扩展中并不经常使用。每次我需要使用它时,我都会发现另一个错误阻止我使用它,或者花费无数时间寻找解决方法。例如:

  • 如果启用拆分隐身模式、使用 webRequest 事件并重新加载扩展程序(例如更新后),Chrome 27 及更早版本将崩溃。
  • 设计缺陷:declarativeWebRequest API 不能在事件页面的隐身模式下使用 (bug 258090)。

关于file - 隐身访问扩展文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17531848/

相关文章:

javascript - Chrome 扩展 - 尝试在后台和第二个内容脚本之间发送消息(?)

javascript - Chrome 扩展 : How do I use declarativeNetRequest to bypass the Content Security Policy

google-chrome - chrome 隐身模式缓存是存储在磁盘还是内存中,是否加密?

selenium - 以隐身模式启动 headless chrome

c++ - 从文件中读取字符串并将其不同部分保存在 C++ 中的不同变量中

C++:解析文本文件并将其读入数组

microsoft-edge - 如何使用 selenium 远程 webdriver 在隐身模式下启动 Edge 浏览器?

python - 对于仅包含整数的文件,基数为 10 的 int() 的文字无效

javascript - htaccess 启动文件 javascript