JavaScript – Redirect to another web page
The below code shows you how to redirect users to another web page using JavaScript/jQuery.
1. If you want to simulate someone clicking on a link, use this:
- pure JavaScript
window.location.href = 'https://bytenota.com';
- jQuery
$(location).attr('href', 'https://bytenota.com')
2. If you want to simulate an HTTP redirect, use this:
- pure JavaScript
window.location.replace('https://bytenota.com');