content_scripts 匹配“chrome-extension://*/*”有效吗?

2024-03-18

我想在带有 chrome-extension:// URL 的 iframe 上运行内容脚本。我在从文档中复制的 manifest.json 中添加了一行http://code.google.com/chrome/extensions/match_patterns.html http://code.google.com/chrome/extensions/match_patterns.html

 chrome-extension://*/*

但是当我重新加载扩展程序时,我收到一条警报:

Could not load extension from '/work/sirius/extension'. 
Invalid value for 'content_scripts[2].matches[0]': Invalid scheme.

知道如何让它发挥作用吗?


没有。只有ftp:, file:, http: and https:可以通过内容脚本声明来匹配。

任何位置的 URL 模式无效matches and exclude_matches字段被拒绝(尝试加载扩展时生成错误)。

无效模式permissions清单文件中的选项 https://developer.chrome.com/extensions/declare_permissions被忽略。

If you want to run a script on a tab from your extension, use chrome.extension.getViews https://developer.chrome.com/extensions/extension#method-getViews in your background script. Even better, design your extension's pages such that they effectively communicate with each other https://developer.chrome.com/extensions/messaging (example https://developer.chrome.com/extensions/messaging#external).

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

content_scripts 匹配“chrome-extension://*/*”有效吗? 的相关文章

随机推荐