Javascript Window Location Replace Function
Javascript location replace function of DOM window object provides the functionality to replace the current URL with new location URL and also allows you to redirect the current URL. You can call the Javascript location replace function using any event of form input fields such as input type button onclick event to replace the current URL with new URL. You can also code the location replace function in the Javascript block of the HTML <head> head section to call the location replace function on body load automatically to redirect the current URL to new URL. Any of the location.replace or window.location.replace can be used in the Javascript code.
JavaScript Window Location Object Examples:
You can see the live samples and examples of JavaScript Window Location Object from the following links:
Syntax of Javascript Window Location Replace Function
location.replace("URL");
or
window.location.replace("URL");
Javascript location replace function accepts 1 parameter of string value type as new location URL path.
Example of Javascript Window Location Replace Function
function redirect() {
location.replace("http://www.ezineasp.net");
}
Above example code for Javascript window location replace function will redirect to new URL onclick event of input type button of HTML document.
Output:
You can see the output of above discussed code from the following link:
Continue to next tutorial: Javascript Location Redirect Function to learn how to create a redirect URL function in JavaScript.

* will not be published
* hint: http://www.example.com