What are the various url properties of location object

Posted by Andre Scott | Updated on

What are the various url properties of location object?

The below Location object properties can be used to access URL components of the page,

  1. href – The entire URL
  2. protocol – The protocol of the URL
  3. host – The hostname and port of the URL
  4. hostname – The hostname of the URL
  5. port – The port number in the URL
  6. pathname – The path name of the URL
  7. search – The query portion of the URL
  8. hash – The anchor portion of the URL

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers