运行 Chrome 除了一个域之外的每个域的扩展名?
Run Chrome extension on every domain except one?
我需要一个 Chrome 扩展到每个域 运行,除了一个。它 运行 无处不在:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]
然而添加exclude_matches
似乎没有效果:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_matches": ["http://*.mysite.com/"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]
我尝试使用这些文档中的匹配模式,但扩展程序仍在该页面上加载:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_matches": ["*://mozilla.org/"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
],
在官方文档中,该示例用于排除域的特定页面,所以它可能不能按照我尝试的方式使用?
https://developer.chrome.com/docs/extensions/mv2/content_scripts/
{
"name": "My extension",
...
"content_scripts": [
{
"matches": ["http://*.nytimes.com/*"],
"exclude_matches": ["*://*/*business*"],
"js": ["contentScript.js"]
}
],
...
}
到 运行 除了“google”域之外的任何地方都使用 exclude_globs
。在 manifest.json
:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_globs": ["*://*.google.*/*"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]
我需要一个 Chrome 扩展到每个域 运行,除了一个。它 运行 无处不在:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]
然而添加exclude_matches
似乎没有效果:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_matches": ["http://*.mysite.com/"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]
我尝试使用这些文档中的匹配模式,但扩展程序仍在该页面上加载:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_matches": ["*://mozilla.org/"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
],
在官方文档中,该示例用于排除域的特定页面,所以它可能不能按照我尝试的方式使用?
https://developer.chrome.com/docs/extensions/mv2/content_scripts/
{
"name": "My extension",
...
"content_scripts": [
{
"matches": ["http://*.nytimes.com/*"],
"exclude_matches": ["*://*/*business*"],
"js": ["contentScript.js"]
}
],
...
}
到 运行 除了“google”域之外的任何地方都使用 exclude_globs
。在 manifest.json
:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"exclude_globs": ["*://*.google.*/*"],
"run_at": "document_start",
"js": ["contentScript.js"]
}
]