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 UserScript 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 may look the same but prevent the script from being executed on this pattern regardless of @include or @match allowances.// ==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/. However please don't shout.
@exclude values may look the same but prevent the script from being executed on this pattern regardless of @include or @match allowances.
/^https?://www\.example.org//
should be the same as /^https?:\/\/www\.example.org\/.*/
in this context. However in other contexts the shorthand syntax may be considered non-portable and may not be 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 one 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
Wiki: Greasemonkey_Manual:API
Wiki: Greasemonkey_Manual:Creating_Scripts
Wiki: Greasemonkey_Manual:Environment
Wiki: Greasemonkey_Manual:Getting_Started
Wiki: Greasemonkey_Manual:Installing_Scripts
Wiki: Greasemonkey_Manual:Managing_Scripts
Wiki: Greasemonkey_Manual:Monkey_Menu
Wiki: Greasemonkey_Manual:Other_Useful_Tools
Wiki: Metadata_Block
Wiki: User_script
Wiki: config.xml