Thursday, August 14, 2014

JavaScript redirection examples

There are two common methods for redirecting users in JavaScript (in the current window).

The first method will not affect the browser history (the back button will not take them back to the page you redirect from). This is good for the login page, where you don't want them going back to the login form.
The second method will redirect the current window and will leave the page you are redirecting from in the browser history (the back button will work).
window.location = url;

No comments:

Post a Comment