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 에서 정보를 얻었는데 지금은 페이지가 사라졌다.)