Dav*_*ite 6 google-chrome google-chrome-extension google-chrome-devtools
我在控制注入内容脚本的页面时遇到问题.在Chrome扩展程序开发指南规定,我可以用一个"exclude_matches"指令在我的manifest.json排除从注射某些网页.
但是,这似乎没有任何效果.我的内容脚本仍然在我指定为忽略的页面上执行.
我已经把步骤重现在一个要点.该代码也可以在Github上找到.
我有什么想法我做错了吗?
的manifest.json
{
"name": "Testing Extension",
"version": "1.0",
"description": "Test the chrome extensions exclude_matches.",
"content_scripts": [{
"matches": ["http://*/*", "https://*/*"],
"exclude_matches": ["http://news.ycombinator.com/"],
"js": ["content.js"]
}]
}
Run Code Online (Sandbox Code Playgroud)
content.js
console.log("hello from the content script");
Run Code Online (Sandbox Code Playgroud)
这是Bug#100106.exclude_matches不能正常运作.
要解决问题,请使用exclude_globs而不是exclude_matches.
此外,您的exclude_matches规则只匹配http://news.ycombinator.com/.
只需使用星号模式匹配整个站点即可:http://news.ycombinator.com/*.
另请参见:匹配模式.
| 归档时间: |
|
| 查看次数: |
3633 次 |
| 最近记录: |