When using JavaScript, it is sometimes too familiar with the methods that are often used and ignores the nuances of their principles.
Examples are as follows:
Window.location.href,window.location.replace.
Both of these ways let the page jump to a new page, but I ignored the details after the jump, such as the original page returned.
Window.location.href is in fact the href in the <a> tag, use this for the page jump, you can use the browser back button back to the original page, you can use the History.go (-1) function to jump to the original page.
The Window.location.replace (URL) method is to have the browser remove the URL from its history and reset the URL. When you use the browser's Back button or forward button, it will not be able to jump to the original page, but to the previous page of the original page.
The replace () method does not generate a new record in the History object. When this method is used, the new URL overwrites the current record in the History object.
The above JavaScript in the comparison of HREF and replace (detailed) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.