loading script to google chrome extension

£可爱£侵袭症+ 提交于 2019-12-21 07:23:11

问题


I'm trying to create new extensions but I'm having a problem when I include the JavaScript:

 {
  "name": "<name>",
  "version": "1.0",
  "description": "<description>",
    "default_icon": "icon.png",
    "content_scripts": [
    {
      "matches": ["http://*.com"],
          "js": ["script.js"]
    }
  ],
  "permissions": [
    "http://*.com/"
  ]
}

I'm having this error:

could not load extension from <path>
Invaild value for 'content_scripts[0].matches[0]':Empty path

回答1:


You have a invalid matches URL - content script match patterns need a scheme, host, and a path. The path includes the first slash / after the host (in this case, *.co.il).
Chrome is complaining that you do not have a path, so you have to add one.

  • If you want to match only http://*.co.il, just change it to http://*.co.il/.
  • If you want to match all paths change it to http://*.co.il/*.


来源:https://stackoverflow.com/questions/6938891/loading-script-to-google-chrome-extension

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