Dive Into Greasemonkey

Teaching an old web new tricks

4.1. Executing a user script on a domain and all its subdomains

Many sites work equally well whether you include the www. prefix in the address or not. If you want to write a user script for such sites, you need to make sure to catch both versions of the address.

Example: Metadata tags to match a domain and all subdomains

// ==UserScript==
// @include http://example.com/*
// @include http://*.example.com/*
// ==/UserScript==

Real examples

← Common Patterns
Testing whether a Greasemonkey function is available →