JavaScript 주소 가져오기

Javascript에서 기본 오브젝트 정보를 가져올 때는 DOM구조를 타고 내려가는게 중요한데

 

location.href 라고 쓰는것은

window.document.location.href 와 동일하다.

 

예) http://memo.polypia.net/archives/2183

location.href  http://memo.polypia.net/archives/2183
        .host  memo.polypia.net
        .protocol  http:
        .pathname  /archives/2183

요즘은 디버거가 잘 되어 있어서 location만 치면 객체구조를 확인가능하다.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 characters available