Please briefly explain why you feel this question should be reported .
Similar to window.location.assign, except that it “replaces” the current document, removing the previous one from the back button history.
var = window.location.replace(url);
url – Data-type: String
Returns an object of type
Force a new page to load and replace the current one.
// similar behavior as an HTTP redirect window.location.replace("https://w3resource.com"); // similar behavior as clicking on a link window.location.href = "https://w3resource.com";
Use window.location.assign because it retains the back button history. The replace method removes the current page from the back history, and therefore may confuse the user.