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 →