Three methods to preform redirection in browser:
- widnow.location.href
- window.location.assign
- window.location.replace
1 & 2, they are pretty much the same, just 1 is the property and 2 is the function, some people say use property is a little bit faster than calling a function. So they prefer using 1th.
1: window.location.href="http://www.egghead.io";2: window.location.assign("http://www.egghead.io");
The differeces between 1 & 2 with 3 is:
, is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document.