Course Content
Javascript Full Course
0/87
JavaScript Course
About Lesson

The Location Object in HTML DOM is used to provide information about the current URL of a webpage. This object is a sub part of a window object. As it get the information by using window.location property. The location Object is used to retrieve the information regarding the hash value, host _name , port number and name of the protocol, and so on.

Below are the predefined properties and methods that are given below.

Properties:  
  • hash: It is used to set or return the anchor part (#) of a URL .
  • host: It is used to set or return the host name and port number of a current webpage URL.
  • hostname: It is used to set or return the host name or the name of the website
  • href: It is used to set or return the value of the whole current url of the webpage.
  • origin: It is used to return the protocol, hostname and port number of a current URL.
  • pathname: It is used to set or return the value of the path name of a webpage.
  • port: It is used to set or return the port number of a current URL.
  • protocol: It is used to set or return the name of the protocol of a current URL.
  • search: It is used to set or return the value of the query string part of a URL.
Methods: 
  • assign() : It can be used for loading a new document but the difference between these two methods is that the replace() method removes the URL of the current document from the document history and therefore it is not possible to navigate back to the original document using the “back” button.
  • reload(): It is used to reload a current document.
  • replace(): It is used to replace a current document with a new document.
Exercise Files
No Attachment Found
No Attachment Found
Join the conversation

Introducing Official ApeStaking Protocol for ApeCoin.

New Blur NFT Marketplace Courting Professional.