<tutorialjinni.com/>

Redirect to another page using JavaScript

Posted Under: JavaScript, Snippets, Tutorials on Aug 19, 2018
JavaScript Snippet to redirect the user to another web page. There are two mechanism for redirecting a user. One as if the user click a link and goes to another page. Second as if the user is being redirected, HTTP Redirect.
// simulates behavior of user clicking a link
window.location.href = "https://www.tutorialjinni.com/";
// simulates a HTTP redirect
window.location.replace("https://www.tutorialjinni.com/");
© Tutorial Jinni