Redirect to another page


Redirecting the user from the current page to another one is a fairly common task, one that pretty much every JavaScript developer knows, but there's one thing that you might not be aware of.


Redirect user to a new page

window.location.href = ''

The code above simulates the behaviour of clicking on a link. However, if you want to redirect a user right after the page load, you don't want to keep the page he requested first in the history. In that case you're better off using this:



Please sign-in to post a comment