This object provides access to the information in the current page URL and also allows you to change to a different page by setting it to a new value. There are a number of properties available to make it easy to get the various parts of the address - hash, host, hostname, href, pathname, port, protocol, and search. There are also several methods available - assign(), replace(), reload().
Assigning a value to location and using the assign method will both replace the current page with the specified new page. The replace() method does the same thing except that it overwrites the current entry in the history instead of creating a new one. The reload() method reloads the current page and takes one boolean parameter to indicate whether or not to force it to reload from the server.
In this example we look at how to transfer to a new page after ten seconds and remove the current page from history at the same time so that your visitors cannot easily return to it (possibly useful for a timed quiz or similar).
setTimeout(function() {
location.replace('nextpage.htm');},
10000);
