The properties contained in the window.location object

  • 2020-03-30 04:05:52
  • OfStack

Hash // URL (anchor) from well number (#)

The host// hostname and the port number of the current URL

Hostname // hostname of the current URL

Href // full URL

Pathname // the path part of the current URL

Port // the port number of the current URL

Protocol // protocol for the current URL

Search // from question mark (?) Start the URL

To locate the anchor using JS, you can use window.hash with the element ID.

To use JS to capture the parameters requested in the page GET mode, you can GET them entirely using window.location.search, and then loop through the free-organization data format with the split method.


Related articles: