This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive tutorial--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.
Instance
Returns the entire url:<script> document.write (location.href) of (current page); </script> above code output: http://www.w3school.com.cn/js/... indow location Pathname
The Location.pathname property returns the path name of the URL.
Instance
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.
Instance
Load a new document:
Click to enter JavaScript Intensive tutorial: http://www.h5edu.cn/htm/step/h5edu_44.html
JavaScript Intensive Tutorial--window location