Getting Started ⬌ Installing Scripts ⬌ Managing Scripts ⬌ Monkey Menu ⬌ Creating Scripts ⬌ Environment ⬌ Other Useful Tools ⬌ API
In general user scripts should specify at least one @include or at least one @exclude in the metadata block.
The script will execute if a user script matches any @include, as long as it does not match an @exclude or a global exclude.
If no @include is provided, @include * is assumed. That is, every URL will be matched within the allowed Pattern recognitions.
Patterns apply to @include, @match, and @exclude values including global excludes unless otherwise specified.
// ==UserScript==
//
// @include http://www.example.org/*
// @include https://www.example.org/*
//
// @match http://www.example.net/*
// @match https://www.example.net/*
//
// @exclude http://www.example.com/*
// @exclude https://www.example.com/*
//
// ==/UserScript==
https://www.example.org/foo/* will match https://www.example.org/foo/bar and https://www.example.org/foo/, but not https://www.example.org/baz/. A value can have several wildcards or none, in which case the value must match the entire URL exactly. Exclude values look the same, and prevent the script from being executed.// ==UserScript==
//
// @include /^https?:\/\/www\.example.(?:org|net)\/.*/
//
// @exclude /^https?:\/\/www\.example.com\/.*/
//
// ==/UserScript==
This pattern is always treated as case insensitive therefore a Url in the address bar of HTTPS://WWW.EXAMPLE.ORG/ is the same as https://www.example.org/.
JavaScript RegExp currently allows forward slashes and trailing match the preceding item 0 or more times special character to be non-escaped and omitted respectively. Therefore /^https?://www\.example.org/.*/ should be the same as /^https?:\/\/www\.example.org\/.*/ in this context. However in other contexts this shorthand syntax is considered non-portable and is may not recommended due to potential cross-browser differences. Better to be safe than sorry later on?
⬆ ⬇ | file: | about: | unmht:| .tld
true.true.https://www.example.tld/* will match any top level domain, such as https://www.example.com, https://www.example.org, https://www.example.co.uk, and so on. One must be careful with this, to not accidentally leak data to a site that they did not mean to match. This list of TLDs includes a myriad of dual-segment TLDs (such as ca.us, aeroport.fr and kyoto.jp), beside the plain country or category codes (com, jp, se). For a full list see this list.Getting Started ⬌ Installing Scripts ⬌ Managing Scripts ⬌ Monkey Menu ⬌ Creating Scripts ⬌ Environment ⬌ Other Useful Tools ⬌ API