Chrome扩展程序:在所有的Google网域和特定网页上运行 [英] Chrome extension: Run on all google domains and a specific page
问题描述
我希望我的内容脚本能够匹配所有Google网域和特定网页。我知道这是不可能的。
Manifest.json
content_scripts:[{
matches:[
,*://www.google.*
,*://www.youtube.com/*
,*://readthedocs.org/*]
,
....
有没有其他方法可以做到这一点?在列出Google所有域名之前,只想确定一下:) 列出所有Google域名并不困难,因为Google已在 http://www.google.com/supported_domains 发布了所有公开Google网域的列表。使用*:// *
为每个项目添加前缀,并为每个项目添加,
后缀。然后将结果复制粘贴到清单文件中。
另一种选择是使用 include_globs
字段(在matches之后应用):
{
....
content_scripts:[{
matches:[*:// * / *],
include_globs:[
*://*.google.*/*,
*://*.youtube.com/*,
*://readthedocs.org/*
,
js:[contentscript.js]
}]
}
(我已替换 I want my content script to match all google domains, and a specific page. I know this is not possible. Manifest.json Is there another way to do this? Just wanted to make sure before I list all domains Google has :) Listing all Google domains is not that difficult, because Google has published a list of all public Google domains at http://www.google.com/supported_domains. Prefix every item in this list with An alternative option is to use the (I've replaced 这篇关于Chrome扩展程序:在所有的Google网域和特定网页上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!*://www.google.com/* 与
*://*.google.com/*
,因为子域名如 https://encrypted.google.com/ ) "content_scripts": [{
"matches": [
,"*://www.google.*"
,"*://www.youtube.com/*"
,"*://readthedocs.org/*"]
,
....
"*://*
and add the ",
suffix to every item. Then copy-paste the result to your manifest file."include_globs"
field (this is applied after "matches"):{
....
"content_scripts": [{
"matches": [ "*://*/*" ],
"include_globs": [
"*://*.google.*/*",
"*://*.youtube.com/*",
"*://readthedocs.org/*"
],
"js": [ "contentscript.js" ]
}]
}
"*://www.google.com/*"
with "*://*.google.com/*
, because of subdomains like https://encrypted.google.com/)