This book is badly out of date and will probably never be updated. You can find more up-to-date information on the Greasemonkey wiki.

Dive Into Greasemonkey

Teaching an old web new tricks

4.20. Redirecting pages

You can use Greasemonkey to automatically redirect certain pages, by setting the window.location.href property.

Example: Redirect a site to its secure counterpart

window.location.href = window.location.href.replace(/^http:/, 'https:');
← Rewriting links
Intercepting user clicks →