Агуулга	
	
The
window.locationobject can be used to get the current page address (URL) and to redirect the browser to a new page.
Window Location #
The window.location object can be written without the window prefix.
Some examples:
- window.location.hrefreturns the href (URL) of the current page
- window.location.hostnamereturns the domain name of the web host
- window.location.pathnamereturns the path and filename of the current page
- window.location.protocolreturns the web protocol used (http: or https:)
- window.location.assign()loads a new document
Window Location Href #
The window.location.href property returns the URL of the current page.
Example #
Display the href (URL) of the current page:
document.getElementById("demo").innerHTML =
"Page location is " + window.location.href;				Result is:
Page location is https://www.Apprentice.mn/js/js_window_location.asp				document.getElementById("demo").innerHTML =
"Page hostname is " + window.location.hostname;				Result is:
Page hostname is www.Apprentice.mn				document.getElementById("demo").innerHTML =
"Page path is " + window.location.pathname;				Result is:
Page path is /js/js_window_location.asp
				document.getElementById("demo").innerHTML =
"Page protocol is " + window.location.protocol;				Result is:
Page protocol is https:				document.getElementById("demo").innerHTML =
"Port number is " + window.location.port;				Result is:
Port number is				<html>
<head>
<script>
function newDoc() {
  window.location.assign("https://www.Apprentice.mn")
}
</script>
</head>
<body>
<input type="button" value="Load new document" onclick="newDoc()">
</body>
</html>				