What is the difference between window.location.assign() and window.location.replace(), when both redirect to a new page?
window.location.assign()
window.location.replace()
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.
window.location.assign("url")
window.location.replace("url")
Reference: http://www.exforsys.com/tutorials/javascript/javascript-location-object.html
1.4m articles
1.4m replys
5 comments
57.0k users