在manifest.json中匹配内容脚本的所有公司国际域的最有效方法是什么?

时间:2013-09-10 19:45:58

标签: google-chrome-extension

我看到两种可能性。

1)使用长“匹配”列表。例如:

  "matches": [
    "*://www.google.com/*",
    "*://www.google.com.af/*",
    "*://www.google.dz/*",
    "*://www.google.as/*",
    "*://www.google.ad/*",
    "*://www.google.co.ao/*",
    "*://www.google.com.ai/*",
    "*://www.google.com.ag/*",
    "*://www.google.com.ar/*",
    "*://www.google.am/*",
    "*://www.google.com.au/*",
    "*://www.google.at/*",
    "*://www.google.az/*",
    "*://www.google.bs/*",
    "*://www.google.com.bh/*",
    "*://www.google.com.bd/*",
    "*://www.google.by/*",
    "*://www.google.be/*",
    "*://www.google.com.bz/*",
    "*://www.google.bj/*",
    "*://www.google.com.bo/*",
    "*://www.google.ba/*",
    "*://www.google.co.bw/*",
    "*://www.google.com.br/*",
    "*://www.google.com.bn/*",
    "*://www.google.bg/*",
    "*://www.google.bf/*",
    "*://www.google.bi/*",
    "*://www.google.com.kh/*",
    "*://www.google.cm/*",
    "*://www.google.ca/*",
    "*://www.google.cv/*",
    "*://www.google.cf/*",
    "*://www.google.td/*",
    "*://www.google.cl/*",
    "*://www.google.cn/*",
    "*://www.google.com.co/*",
    "*://www.google.cg/*",
    "*://www.google.cd/*",
    "*://www.google.co.ck/*",
    "*://www.google.co.cr/*",
    "*://www.google.ci/*",
    "*://www.google.hr/*",
    "*://www.google.com.cu/*",
    "*://www.google.com.cy/*",
    "*://www.google.cz/*",
    "*://www.google.dk/*",
    "*://www.google.dj/*",
    "*://www.google.dm/*",
    "*://www.google.com.do/*",
    "*://www.google.com.ec/*",
    "*://www.google.com.eg/*",
    "*://www.google.com.sv/*",
    "*://www.google.ee/*",
    "*://www.google.com.et/*",
    "*://www.google.com.fj/*",
    "*://www.google.fi/*",
    "*://www.google.fr/*",
    "*://www.google.ga/*",
    "*://www.google.gm/*",
    "*://www.google.ge/*",
    "*://www.google.de/*",
    "*://www.google.com.gh/*",
    "*://www.google.com.gi/*",
    "*://www.google.gr/*",
    "*://www.google.gl/*",
    "*://www.google.gp/*",
    "*://www.google.com.gt/*",
    "*://www.google.gg/*",
    "*://www.google.gy/*",
    "*://www.google.ht/*",
    "*://www.google.hn/*",
    "*://www.google.com.hk/*",
    "*://www.google.hu/*",
    "*://www.google.is/*",
    "*://www.google.co.in/*",
    "*://www.google.co.id/*",
    "*://www.google.iq/*",
    "*://www.google.ie/*",
    "*://www.google.im/*",
    "*://www.google.co.il/*",
    "*://www.google.it/*",
    "*://www.google.com.jm/*",
    "*://www.google.co.jp/*",
    "*://www.google.je/*",
    "*://www.google.jo/*",
    "*://www.google.kz/*",
    "*://www.google.co.ke/*",
    "*://www.google.ki/*",
    "*://www.google.co.kr/*",
    "*://www.google.com.kw/*",
    "*://www.google.kg/*",
    "*://www.google.la/*",
    "*://www.google.lv/*",
    "*://www.google.com.lb/*",
    "*://www.google.co.ls/*",
    "*://www.google.com.ly/*",
    "*://www.google.li/*",
    "*://www.google.lt/*",
    "*://www.google.lu/*",
    "*://www.google.mk/*",
    "*://www.google.mg/*",
    "*://www.google.mw/*",
    "*://www.google.com.my/*",
    "*://www.google.mv/*",
    "*://www.google.ml/*",
    "*://www.google.com.mt/*",
    "*://www.google.mu/*",
    "*://www.google.com.mx/*",
    "*://www.google.fm/*",
    "*://www.google.md/*",
    "*://www.google.mn/*",
    "*://www.google.me/*",
    "*://www.google.ms/*",
    "*://www.google.co.ma/*",
    "*://www.google.co.mz/*",
    "*://www.google.com.na/*",
    "*://www.google.nr/*",
    "*://www.google.com.np/*",
    "*://www.google.nl/*",
    "*://www.google.co.nz/*",
    "*://www.google.com.ni/*",
    "*://www.google.ne/*",
    "*://www.google.com.ng/*",
    "*://www.google.nu/*",
    "*://www.google.com.nf/*",
    "*://www.google.no/*",
    "*://www.google.com.om/*",
    "*://www.google.com.pk/*",
    "*://www.google.ps/*",
    "*://www.google.com.pa/*",
    "*://www.google.com.py/*",
    "*://www.google.com.pe/*",
    "*://www.google.com.ph/*",
    "*://www.google.pn/*",
    "*://www.google.pl/*",
    "*://www.google.pt/*",
    "*://www.google.com.pr/*",
    "*://www.google.com.qa/*",
    "*://www.google.cat/*",
    "*://www.google.ro/*",
    "*://www.google.ru/*",
    "*://www.google.rw/*",
    "*://www.google.sh/*",
    "*://www.google.com.vc/*",
    "*://www.google.ws/*",
    "*://www.google.sm/*",
    "*://www.google.st/*",
    "*://www.google.com.sa/*",
    "*://www.google.sn/*",
    "*://www.google.rs/*",
    "*://www.google.sc/*",
    "*://www.google.com.sl/*",
    "*://www.google.com.sg/*",
    "*://www.google.sk/*",
    "*://www.google.si/*",
    "*://www.google.com.sb/*",
    "*://www.google.so/*",
    "*://www.google.co.za/*",
    "*://www.google.es/*",
    "*://www.google.lk/*",
    "*://www.google.se/*",
    "*://www.google.ch/*",
    "*://www.google.com.tw/*",
    "*://www.google.com.tj/*",
    "*://www.google.co.tz/*",
    "*://www.google.co.th/*",
    "*://www.google.tl/*",
    "*://www.google.tg/*",
    "*://www.google.tk/*",
    "*://www.google.to/*",
    "*://www.google.tt/*",
    "*://www.google.tn/*",
    "*://www.google.com.tr/*",
    "*://www.google.tm/*",
    "*://www.google.co.ug/*",
    "*://www.google.com.ua/*",
    "*://www.google.ae/*",
    "*://www.google.co.uk/*",
    "*://www.google.com/*",
    "*://www.google.com.uy/*",
    "*://www.google.co.uz/*",
    "*://www.google.vu/*",
    "*://www.google.co.ve/*",
    "*://www.google.com.vn/*",
    "*://www.google.vg/*",
    "*://www.google.co.vi/*",
    "*://www.google.co.zm/*",
    "*://www.google.co.zw/*"],

2)使用与所有域匹配的令牌matches表达式以及更强大的match_globs的更短列表。例如:

  "matches": ["*://*/*"],
  "match_globs": [
    "*://www.google.c??/*",
    "*://www.google.com.??/*",
    "*://www.google.co.??/*",
    "*://www.google.??/*"],

哪个Chrome会更快执行?

匹配域和非匹配域的答案是否相同?

0 个答案:

没有答案