This article ish5eduAgency officialHTML5 Trainingtutorials, the main introduction:JavaScript Intensive Tutorials--window Location
Window Location
The Window.location object can be written without using the window prefix.
Some examples:
Location.hostname Returns the domain name of the web host
Location.pathname returns the path and file name of the current page
Location.port Returns the port of the web host (80 or 443)
Location.protocol returns the Web protocol used (HTTP///https://)
Window location Href
The Location.href property returns the URL of the current page.
Example
The entire url:<script> document.write (LOCATION.HREF) is returned (the current page); </script> The above code output is:http://www.w3school.com.cn/js/... IndowLocation Pathname
The Location.pathname property returns the path name of the URL.
Example
returns the path name of the current URL:<script> document.write (location.pathname); </script> above code output is:/js/js_window_ Location.aspwindow location Assign
the Location.assign () method loads the new document.
Example
load a new document:Http://www.w3school.com.cn ";) } </script>
Click to enter JavaScript intensive tutorial
This article is from the "11721999" blog, please be sure to keep this source http://11731999.blog.51cto.com/11721999/1844649
JavaScript Intensive Tutorial--window location