Easy Tutorial
❮ Jsref Setutcmilliseconds Prop Attr Value ❯

replace() Method


Definition and Usage

The replace() method can replace the current document with a new document.

Syntax


Browser Support

All major browsers support the replace() method.


Example

Example

Using the replace() method to replace the current document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function replaceDoc(){
    window.location.replace("https://www.tutorialpro.org")
}
</script>
</head>
<body>

<input type="button" value="Load new document to replace current page" onclick="replaceDoc()">

</body>
</html>

❮ Jsref Setutcmilliseconds Prop Attr Value ❯