Include and exclude rules

From GreaseSpot Wiki
Revision as of 01:58, 20 November 2006 by Ldrhcp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

User scripts specify include and exclude rules in the metadata block. The script will execute if it matches any include rule, as long as it does not match an exclude rule. The rules are URLs, which can have a "wildcard" asterisk (*), which matches any string. For example:* will match and, but not A rule can have several wildcards or none, in which case the rule must match the entire URL exactly. Exclude rules look the same, and prevent the script from being executed. An example:

// ==UserScript==
// @include*
// @include*.bar
// @exclude
// ==/UserScript==

If no include rule is provided, @include * is assumed. That is, every URL will be matched.

Magic TLD

The only special syntax besides the wildcard is .tld. An include such as http://www.example.tld/* will match any top level domain, such as,,, and so on. One must be careful with this, to not accidentally leak data to a site that they did not mean to match.