본문 바로가기

잡다한 개발 지식

window.location과 window.document.location의 차이

window.location 과 window.document.location의 차이
- The window.location is read and write in all browser
- Whereas, document.location is read-only in Internet Explorer and read/write in Gecko-based browsers.

https://www.tutorialspoint.com/what-s-the-difference-between-window-location-and-document-location
location의 정보를 얻고 싶을땐 window.location에서 가져오는게 맞으며 window.document.location의 사용은 지양해야 함
(window.document.location은 과거 ie등에서 사용하였지만 지금은 deprecated, 지금은 크로스 브라우징 처리를 위해 최신 브라우저에 내장은 되어 있음)