location.replace
[JS] location 객체의 href/assign, replace 차이점
[JS] location 객체의 href/assign, replace 차이점
2024.04.24차이점 요약window.location.assign(및 href) : 정보를 전송하지 않고 페이지만 이동 / 뒤로 가기 가능window.location.replace : 정보를 전송하지 않고 페이지만 교체 / 뒤로 가기 불가window.location.reload : 현재 페이지의 문서 다시 로드 window.location.assign (href)뒤로 가기 버튼을 눌러 이전 페이지로 이동할 수 있다주소 히스토리에 기록된다뒤로 가기 : location.assign 메서드를 호출한 페이지로 이동용도 : URL을 이동하는 대부분의 경우에 사용location.href``location.assign 이 둘은 사용법만 다를 뿐 기능은 동일하다 window.location.href = "url"; // locati..