JavaScript to replace the current page
- 2020-05-26 07:42:31
- OfStack
This article demonstrates how JavaScript can replace the current page. Share with you for your reference. The details are as follows:
The JS code below replaces the current page with the URL specified
<!DOCTYPE html>
<html>
<head>
<script>
function replaceDoc()
{
window.location.replace("https://www.ofstack.com")
}
</script>
</head>
<body>
<input type="button" value="Replace document"
onclick="replaceDoc()">
</body>
</html>
I hope this article has been helpful to your javascript programming.