1// similar behavior as an HTTP redirect
2window.location.replace("http://codegrepper.com");
3
4// similar behavior as clicking on a link
5window.location.href = "http://codegrepper.com";
6
7window.location.href; // Returns the href (URL) of the current page
8window.location.hostname; // Returns the domain name of the web host
9window.location.pathname; // Returns the path and filename of the current page
10window.location.protocol; // Returns the web protocol used (http: or https:)
11window.location.assign; // Loads a new document
12window.location.replace; // RReplace the current location with new one.
1// similar behavior as an HTTP redirect
2window.location.replace("http://stackoverflow.com");
3
4// similar behavior as clicking on a link
5window.location.href = "http://stackoverflow.com";
6
7// Another method for doing redirecting with JavaScript is this:
8window.location = "https://stackoverflow.com";