I want to know what is the difference between location.replace() and location.assign().
I looked carefully but I didn’t notice any difference between them!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
location.replace()goes to the page with the argument, replacing the current page in history.location.assign()goes to the page with the argument, adding a new item to the history.https://developer.mozilla.org/en-US/docs/Web/API/Window/location