9D4U 2019. 5. 20. 15:57
728x90
반응형

예시)
url - http://localhost:8080/test/test.do?param=data


location.href : http://localhost:8080/test/test.do?param=data <- 전체를 다 가져옴
○location.protocol : http <- 프로토콜을 가져옴
location.host : localhost:8080 <- 호스트를 가져옴
○location.pathname : /test/test.do <- 루트 하위 경로르르 가져옴
location.search : ?param=data <- 파라미터를 가져옴


[제이쿼리]

●$(location).attr('href') = location.href
●$(location).attr('protocol') = location.protocol
●$(location).attr('host') = location.host
●$(location).attr('pathname') = location.pathname
●$(location).attr('search') = location.search

728x90