Location Object
Location Object
Location object contains information about the current URL.
Location object is part of the window object, it can be accessed by window.Location property.
Note: There areno open standards Location is applied to the object, but all browsers support the object.
Location Object Properties
Attributes | description |
---|---|
hash | Returns the anchor part of the URL |
host | Returns the host name and port of a URL |
hostname | Return URL's hostname |
href | Returns the full URL |
pathname | URL pathname returned. |
port | Returns a URL port number used by the server |
protocol | Returns a URL protocol |
search | Returns the query portion of a URL |
Location Object
method | Explanation |
---|---|
assign () | Loading a new document |
reload () | Reload the current document |
replace () | Replaces the current document with a new document |