Difference between window.location.assign() and window.location.replace()

Solution 1:

Using window.location.assign("url") will just cause a new document to load. Using window.location.replace("url") will replace the current document and replace the current History with that URL making it so you can't go back to the previous document loaded.

Reference: http://www.exforsys.com/tutorials/javascript/javascript-location-object.html

Solution 2:

The difference is how history is handled. "Replace" won't give you history, "assign" will.

Solution 3:

According to MDN:

The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.