JavaScript
[Javascript] location 객체 url 정보 가져오기
힘없는염소
2016. 3. 14. 11:11
// 자바스크립트 url 주소 가져오기// url : 192.168.0.0:8000/test/test.do?a=10// Javascriptlocation.href // 192.168.0.0:8000/test/test.do?a=10location.protocol // http:location.host // 192.168.0.0:8000location.pathname // /test/test.dolocation.search // ?a=10 // ?key=value 쿼리스트링// jQueryconsole.log($(location).attr('href'));console.log($(location).attr('protocol'));console.log($(location).attr('host'));console.log($(location).attr('pathname'));console.log($(location).attr('search'));
반응형