본문 바로가기
JQuery

JQuery 현재 URL, 경로 가져오는 방법

by 띵앤띵 2020. 6. 20.
728x90
반응형

javascript

 

window.location.host #returns host

window.location.hostname #returns hostname 

window.location.pathname #return pathname 

window.location.href  #returns full current url 

window.location.port  #returns the port 

window.location.protocol #returns the protocol

 

 

jQuery

 

$(location).attr('host'); #returns host
$(location).attr('hostname'); #returns hostname
$(location).attr('pathname'); #returns pathname

$(location).attr('href'); #returns href 

$(location).attr('port'); #returns port 

$(location).attr('protocol'); #returns protocol

 

 

 

 

참고사이트 : http://stackoverflow.com/questions/406192/get-current-url-in-javascript
출처: https://88240.tistory.com/385 [shaking blog]

반응형

댓글