Javascript window location object properties contain information about the current URL. For example” location.pathname” returns “/subdirectory/search.”


Example URL:

Javascript Window Location Object Properties

Property Description Returns
hash Returns the anchor portion of a URL #somewhere
host Returns the hostname and port of a URL (will include port if one exists)
hostname Returns the hostname of a URL
href Returns the entire URL
pathname Returns the path name of a URL /subdirectory/search
port Returns the port number the server uses for a URL (empty string)
protocol Returns the protocol of a URL http:
search Returns the query portion of a URL ?filter=a


Javascript Window Location Object Properties Alert

Read about Javascript window location object methods.

View Javascript window location object properties.

Search Terms:

Javascript window location object properties, Javascript Window Location object, Javascript Location object, Javascript Window Location, Window Location object, location object


One thought on “Javascript Window Location object Properties

  1. Pingback: Javascript Window Location Object Methods

Leave a reply


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">