简体   繁体   中英

Use every top level domain for content script matches in firefox addon

I want to be able to use every top level domain without having to manually add them all

but when i use * it gives me an error when trying to add the extension

is there any way to make this work?

  "content_scripts":
  [
    {
      "matches": ["*://*.google.*/*"],
      "js":["js/jquery.min.js", "js/content_script.js"]
    }
  ],

So i looked it up and it's actually not possible as of now to do it cleanly with matches

https://groups.google.com/a/chromium.org/forum/#!topic/chromium-extensions/njkDwIF7WDc

so i settled for an if statement in my content script

if (location.href.indexOf("google.") !== -1) {

it's the "cleanest" thing i can come up with it's not perfect but better than adding all google TPD's manually with a 50 item array

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