<body>
  <div>
    <button onclick="GetLocation()">reset</button><br />
	  <br />
		javascript<br />
    window.location.hash = <label id="labHash"></label><br />
		window.location.host = <label id="labHost"></label><br />
		window.location.hostname = <label id="labHostname"></label><br />
		window.location.pathname = <label id="labPathname"></label><br />
		window.location.href = <label id="labHref"></label><br />
    window.location.origin = <label id="labOrigin"></label><br />
		window.location.port = <label id="labPort"></label><br />
		window.location.protocol = <label id="labProtocol"></label><br />
    window.location.search = <label id="labSearch"></label><br />
		<br />
		<br />
    jquery<br />
    $(location).attr("hash");  = <label id="labHashJQ"></label><br />
		$(location).attr("host");  = <label id="labHostJQ"></label><br />
		$(location).attr("hostname"); = <label id="labHostnameJQ"></label><br />
		$(location).attr("pathname");  = <label id="labPathnameJQ"></label><br />
		$(location).attr("href"); = <label id="labHrefJQ"></label><br />
    $(location).attr("origin"); = <label id="labOriginJQ"></label><br />
		$(location).attr("port"); = <label id="labPortJQ"></label><br />
		$(location).attr("protocol"); = <label id="labProtocolJQ"></label><br />
    $(location).attr("search"); = <label id="labSearchJQ"></label><br />
	</div>
</body>
function GetLocation() {
			var objLocation = window.location;
      $("#labHash").text(objLocation.hash);
			$("#labHost").text(objLocation.host);
			$("#labHostname").text(objLocation.hostname);
			$("#labPathname").text(objLocation.pathname);
			$("#labHref").text(objLocation.href);
      $("#labOrigin").text(objLocation.origin);
			$("#labPort").text(objLocation.port);
			$("#labProtocol").text(objLocation.protocol);
      $("#labSearch").text(objLocation.search);
			
			var objLocationJQ = $(location);
      $("#labHashJQ").text(objLocationJQ.attr("hash"));
			$("#labHostJQ").text(objLocationJQ.attr("host"));
			$("#labHostnameJQ").text(objLocationJQ.attr("hostname"));
			$("#labPathnameJQ").text(objLocationJQ.attr("pathname"));
			$("#labHrefJQ").text(objLocationJQ.attr("href"));
      $("#labOriginJQ").text(objLocationJQ.attr("origin"));
			$("#labPortJQ").text(objLocationJQ.attr("port"));
			$("#labProtocolJQ").text(objLocationJQ.attr("protocol"));
      $("#labSearchJQ").text(objLocationJQ.attr("search"));
		}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js