I'm trying to have it so that my content script runs on every site except for 3. I know there's probably a way to do it with regex but I'd prefer not to. Does the chrome extension manifest allow for exceptions?
If regex is the only solution and anyone knows the pattern to exclude these 3 URLs that would be great too.
https://www.linkedin.com/
https://mail.google.com/
https://twitter.com/
https://developer.chrome.com/extensions/content_scripts lists an option exclude_matches
:
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["myscript.js"],
"exclude_matches": [
"https://www.linkedin.com/",
"https://mail.google.com/",
"https://twitter.com/"
]
}
]
I'm guessing you'll want a *
at the end of those: "https://twitter.com/*"
, et.c., to exclude the script on all pages on those domains, and not just the homepages.
You can also look into the exclude_globs
option.
Well, in this case, Regex is quite straight forward:
(www\.linkedin\.com)|(mail\.google\.com)|(twitter\.com)
)nly thing, you have to escape the dots (.) With Backslash (). Assuming the protocol should be left open. Else just put the escaped protocol up front
https:\/\/
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