简体   繁体   中英

loading script to google chrome extension

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

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/* .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM