Easy Tutorial
❮ Met Win Prompt Met Canvas Createimagedata ❯

Location Object


Location Object

The Location object contains information about the current URL.

The Location object is part of the window object and can be accessed via properties in the format window.location.xxx.

Note: There is no public standard that applies to the Location object, but all browsers support it.


Location Object Properties

Property Description
hash Returns the anchor part of a URL
host Returns the hostname and port of a URL
hostname Returns the hostname of the URL
href Returns the entire URL
pathname Returns the path name of the URL
port Returns the port number used by the server of a URL
protocol Returns the protocol of a URL
search Returns the query part of a URL

Location Object Methods

Method Description
assign() Loads a new document
reload() Reloads the current document
replace() Replaces the current document with a new one
❮ Met Win Prompt Met Canvas Createimagedata ❯