Google chrome extension Chrome扩展-不区分大小写的内容脚本匹配
在我的清单中,我根据特定的页面名称注入了一些内容脚本 但是,似乎匹配区分大小写,因此它匹配example.html,但不匹配example.html 如何使其不区分大小写Google chrome extension Chrome扩展-不区分大小写的内容脚本匹配,google-chrome-extension,Google Chrome Extension,在我的清单中,我根据特定的页面名称注入了一些内容脚本 但是,似乎匹配区分大小写,因此它匹配example.html,但不匹配example.html 如何使其不区分大小写 "content_scripts": [ { "matches": ["http://*/example.html"], "css": ["mystyles.css"], "js": ["jquery.js", "myscript.js"] } ] 您现在可能已经明白
"content_scripts": [
{
"matches": ["http://*/example.html"],
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"]
}
]
您现在可能已经明白了这一点,但是没有办法不敏感地应用匹配模式大小写。根据,匹配模式不支持正则表达式(仅,即使用通配符的模式匹配) 因此,您需要明确地输入不同的变体(例如
http://*/example.html
和http://*/example.html
)
或者,您可以使用include_globs
元素,例如,允许所有以任何字母开头并后跟“example”的路径,但这也将允许像../Axample.html
等路径,因此它可能不适合您的目的
{
"matches": ["http://*/*.html"],
"include_globs": ["http://*/?xample.html"]
...
另请参见有关