chrome:// Invalid Scheme

做~自己de王妃 提交于 2021-02-18 19:41:37

问题


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:

{
  "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"]
  } ]
}

回答1:


Note: This is an undocumented feature and may fail without warning in the future.

chrome://extensions is an invalid match pattern. You cannot omit the path component, so at the very least you should use "chrome://extensions/*".

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.

To run a content script at the extensions page, use --extensions-on-chrome-urls and:

  "content_scripts": [{
    "matches": ["chrome://chrome/extensions*"],
    "js": ["script.js"]
  }]

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"]
  }]


来源:https://stackoverflow.com/questions/41747941/chrome-invalid-scheme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!