How does // @match & // @include works in specific situation.
// @match & // @include has nothing really to do with location.origin + location.pathname + location.search
location.origin + location.pathname + location.search should be inside an if or switch condition.
Include is better than match if you want to use regex to match the website name, and if you are good at regex. Match is kind of a basic version of include.
Your question doesn't really make sense.
// @match & // @include has nothing really to do with location.origin + location.pathname + location.search
location.origin + location.pathname + location.search should be inside an if or switch condition.
Include is better than match if you want to use regex to match the website name, and if you are good at regex. Match is kind of a basic version of include.
Ooooh, I did not know differences before, thank you.
@match is more robust and recommended over @include.
@include supports Regular Expression but @match doesn't.
Both are converted to RegEx at the end but implications are different.
There can be unintended results with @include.
@match
The @match metadata imperative is very similar to @include, however it is safer. It sets more strict rules on what the * character means.
For details, see the documentation on Match Patterns for Google Chrome. Chrome implemented@matchfirst, and Greasemonkey has been designed to be compatible.
Examples;
// @include *://*google.com/*
Above can also catch:
google.com
notgoogle.com
some.other.blahgoogle.com
abc.def.blog.com/google.com
@match can catch with or without subdomains, so no need for extra entry for subdomains
// @match `*://*.google.com/*
Above will also catch:
google.com
www.google.com
xyz.google.com

Hi there! I had a question about
// @matchand// @include, I'll show example for better understanding:There are some examples of
@include, okay, now question:Should script work if
location.searchdoes not equal location.origin + location.pathname + location.search written in script?