■表示ページのURL情報を参照したい


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>表示ページやリンクに設定されているURL情報を参照したい</title>
</head>
<body>
<p>■表示ページのURL情報を参照したい</p>
<p>
<script type="text/JavaScript">
<!--
document.write("URL全体 = "+location.href+"<br>");
document.write("プロトコル = "+location.protocol+"<br>");
document.write("ホスト名:ポート番号 = "+location.host+"<br>");
document.write("ホスト名 = "+location.hostname+"<br>");
document.write("ポート番号 = "+location.port+"<br>");
document.write("ドキュメントパス = "+location.pathname+"<br>");
document.write("「?」以降 = "+location.search+"<br>");
document.write("「#」以降 = "+location.hash);
// -->
</script>
</p>
</body>
</html>


★解説★