Location replace() Method
Location Object
Definition and Usage
The replace() method replaces the current document with a new one.
Syntax
Browser Support

The replace() method is supported in all major browsers.
Example
Example
Replace the current document:
<html>
<head>
<script>
function replaceDoc()
{
window.location.replace("http://www.w3schools.com")
}
</script>
</head>
<body>
<input type="button" value="Replace document"
onclick="replaceDoc()">
</body>
</html>
Try it yourself »
Location Object
Thank You For Helping Us!
Your message has been sent to W3Schools.
Close [X]