Client side page redirection can be implemented easily in JavaScript. To do this, you are only required to add a line at the head section of your code.
Redirect from one page to another page after click
<!DOCTYPE html>
<html>
<head>
<script>
function Redirect() {
window.location="https://www.pythonprogramming.in/";
}
</script>
</head>
<body>
<form>
<input type="button" value="Redirect" onclick="Redirect();" />
</form>
</body>
</html>
Redirect using jQuery
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script>
function Redirect() {
$(location).attr('href', 'https://www.pythonprogramming.in/');
}
</script>
</head>
<body>
<form>
<input type="button" value="Redirect" onclick="Redirect();" />
</form>
</body>
</html>
Most Helpful This Week
Write a function that splits an array into groups the length of size and returns them as a two-dimensional array
How to change text color on click using JavaScript?
JavaScript calculate Fahrenheit from Celsius
How to current URL, HOST and URL attributes using JavaScript or jQuery?
Example to take user input and display on screen using JavaScript
How to define Global Variable in JavaScript?