chrome://无效的方案 [英] chrome:// Invalid Scheme
问题描述
我启用了"chrome://flags/#extensions-on-chrome-urls",这应该允许我创建可以在chrome://网站上运行的扩展程序.但是,当我尝试解压缩扩展程序时,它失败并显示错误消息:'content_scripts [0] .matches [0]'的值无效:方案无效".我不相信我的script.js是个问题,因为当我用http或https网站替换"chrome://extensions"部分时,解压缩不会失败.任何帮助将不胜感激,有人知道解决方法吗?
I've enabled "chrome://flags/#extensions-on-chrome-urls" which should allow me to create extensions that can run on chrome:// sites. When I try to unpack my extension, however, it fails with the error message: "Invalid value for 'content_scripts[0].matches[0]': Invalid scheme." I don't believe my script.js is a problem since the unpacking doesn't fail when I replace the "chrome://extensions" part with an http or https sites. Any help would be greatly appreciated, does anyone know a fix?
manifest.json:
manifest.json:
{
"name": "Does something on chrome://extensions",
"version": "1.2",
"description": "Read the name",
"manifest_version": 2,
"browser_action": {
"default_title": "Ext",
"default_popup": "popup.html"
},
"content_scripts": [ {
"matches": ["chrome://extensions"],
"js": ["script.js"]
} ]
}
推荐答案
注意:这是一个未记录的功能,将来可能会在没有警告的情况下失败.
chrome://扩展名
是无效的匹配模式.您不能忽略路径组件,因此至少应使用"chrome://extensions/*"
.
chrome://extensions
is an invalid match pattern. You cannot omit the path component, so at the very least you should use "chrome://extensions/*"
.
但这也不起作用,因为实际的URL是 chrome://chrome/extensions
.或者,如果您对显示扩展列表的页面特别感兴趣,请 chrome://extensions-frame
.
This does however not work either, because the actual URL is chrome://chrome/extensions
. Or, if you are specifically interested in the page that shows the list of extensions, chrome://extensions-frame
.
要在扩展页面上运行内容脚本,请使用-extensions-on-chrome-urls
和:
To run a content script at the extensions page, use --extensions-on-chrome-urls
and:
"content_scripts": [{
"matches": ["chrome://chrome/extensions*"],
"js": ["script.js"]
}]
或(列出所有扩展名的框架,即您访问 chrome://extensions
时看到的内容):
or (the frame that lists all extensions, i.e. what you see when you visit chrome://extensions
):
"content_scripts": [{
"matches": ["chrome://extensions-frame/*"],
"all_frames": true,
"js": ["script.js"]
}]
这篇关于chrome://无效的方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!