In my manifest I am injecting some content scripts based on a specific page name.
However it appears that the matching is case sensitive, so it matches example.html but not Example.html.
How can I make it not case sensitive?
"content_scripts": [
{
"matches": ["http://*/example.html"],
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"]
}
]
You have probably figured that out by now, but there is no way to apply a match pattern case-insensitively. According to the docs, the Match Patterns do not support regular expressions (only globs, a.k.a. pattern matching using wildcard characters).
So, you need to explicitely enter the different variation (e.g. http://*/example.html
and http://*/Example.html
)
Alternatively, you could use the include_globs
element, e.g. allowing all paths starting with any letter followed by "xample", but this will also allow paths like .../Axample.html
etc, so it might probably not fit your purpose.
{
"matches": ["http://*/*.html"],
"include_globs": ["http://*/?xample.html"]
...
See, also, the documentation about Match Patterns and globs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With