There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.Close
Processing...
This may take a few seconds.

location

Syntax

location: ["](url)["] [every (time)] [after (time)];

This command does a hard redirect of the current page to the specified URL. Optional double-quotes surround the URL.

The following example redirects the current page to an outside URL:

#mdnLink:click {
    location: "https://developer.mozilla.org/en-US/docs/Web/";
}

Note: It runs a Javascript document.location.href on the current document, or tries to do it on the target document if the target is an iframe.

For more details on document.location.href, see here:

https://developer.mozilla.org/en-US/docs/Web/API/Document/location

location

Click the button below for an 80s throwback.

#locationButton:click {
    location: "https://www.youtube.com/watch?v=btPJPFnesV4";
}
<p>Click the button below for an 80s throwback.</p>

<button id="locationButton">Click me</button>