자바스크립트 URL 정보 보기

,
hostname = window.location.hostname;
href = window.location.href;
host = window.location.host;
port = window.location.port;
pathname = window.location.pathname;
search = window.location.search;
protocoal = window.location.protocol;

document.write(hostname);
document.write('<br />');
document.write(href);
document.write('<br />');
document.write(host);
document.write('<br />');
document.write(port);
document.write('<br />');
document.write(pathname);
document.write('<br />');
document.write(search);
document.write('<br />');
document.write(protocoal);

/**
결과
localhost
http://localhost:8080/article/pageView.jsp?articleNo=34&pageNo=1
localhost:8080
8080
/article/pageView.jsp
?articleNo=34&pageNo=1
http:
*/

참고 : 자바스크립트로 url 알아내기(http://bluefubu.net/zbxe/220 에서 정보를 얻었는데 지금은 페이지가 사라졌다.)

카테고리 글 목록 👉

,

대표글

“자바스크립트 URL 정보 보기” 에 하나의 답글

  1. […] /article/pageView.jsp       ?articleNo=34&pageNo=1       http:     */ 자료출처 : https://mytory.net/archives/259 Share → (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if […]

자바스크립트 URL 정보 보기 | bokwang 에 응답 남기기응답 취소