This is the concept of page redirection. We make use of Window.Location inorder to redirect an user from the current page to some other page. Let us consider an example on how to use Window.Location in the script tag of html to navigate to some other page.
In the above example, the Window.Location.replace redirects the page to ToPoint.in as the location is specified so. In order to make use of the above method, what ever the page you wanted to redirect your current page, your can do that by specifying the URL in Window.Location.replace.
If you want to do that when an user clicks on some button or a link, you can make use of onclick event to trigger the above function.The similar redirect can be achieved by using the below code when you want the redirect to happen after some action.
Difference between Window.Location.replace and Window.Location.href is replace doesn’t store the previous session history as a result there will not be any back navigation enabled to the initial page from where the redirection occured. Instead, in href the session history contains the original page from where the user is redirected. Hence, back button will be enabled.