Front-Html/Javascript

javascript로 현재 url 분석

seongsland 2012. 8. 20. 17:10

현재 url정보를 담고 있는 javascript 소개

- window.location

현재 url에 대한 풀 주소

- window.location.hostname

도메인에 대한 정보

- window.location.pathname

현재 페이지에 대한 정보

- window.location.search

get 방식으로 넘어온 파라미터 정보


window.location = "http://" + window.location.hostname + window.location.pathname + window.location.search