我的匹配方案:
"content_scripts" : [
{
"matches" : [
"https://stackoverflow.com/questions#epic*"
],
"js" : ["silly.js"]
}
],因此,如果用户转到一个网页(如https://stackoverflow.com/questions),然后添加#epic,它将转到https://stackoverflow.com/questions#epic,但在URL的末尾会有#epic,这将激活内容脚本silly.js。
这就是应该发生的事情,但这并不管用。
发布于 2013-04-12 07:01:28
参见Content scripts, Match Patterns。
匹配模式不会对网址的fragment部分进行操作。
要将内容脚本限制为给定的散列,请使用the include_globs and/or exclude_globs properties。
例如,在这种情况下,您可以使用:
"content_scripts" : [ {
"matches" : [
"*://stackoverflow.com/questions/*"
],
"include_globs" : ["*#epic*"],
"js" : ["silly.js"]
} ],https://stackoverflow.com/questions/15959090
复制相似问题