<!DOCTYPE html>
<html>
<head>
<title>How to redirect another webpage using JavaScript? -PHP Kishan</title>
<script>
function new_Location(newurl) {
/* The wwindow.location method redirect to another webpage location. */
window.location = newurl;
// OR //
/* The window.location.href() method redirect to another webpage location. */
window.location.href = newurl;
// OR //
/* The window.location.assign() method loads a new location in the browser. */
window.location.assign(newurl);
// OR //
/* The window.location.replace() method current location to redirect a new location in the browser. */
window.location.replace(newurl);
}
var new_url = "https://phpkishan.blogspot.com/"; // Assigen New URL Location
</script>
</head>
<body>
<p>You can use any one method as per requirement for redirect your document location.</p>
<input type="button" value="Redirect to new location" onclick="new_Location(new_url)">
</body>
</html>