// 자바스크립트 url 주소 가져오기
// url : 192.168.0.0:8000/test/test.do?a=10
// Javascript
location.href // 192.168.0.0:8000/test/test.do?a=10
location.protocol // http:
location.host // 192.168.0.0:8000
location.pathname // /test/test.do
location.search // ?a=10 // ?key=value 쿼리스트링
// jQuery
console.log($(location).attr('href'));
console.log($(location).attr('protocol'));
console.log($(location).attr('host'));
console.log($(location).attr('pathname'));
console.log($(location).attr('search'));


반응형
Posted by 힘없는염소