JavaScript Location : Object
Location describes the url of the current page. It is available
through the window.location
property.
See also History.
Here's an example:
Property | Value |
---|---|
href
|
'http://username:password@:80/pathname?search=terms#hash'
|
protocol
|
'http:'
|
username
|
'username'
|
password
|
'password'
|
hostname
|
''
|
port
|
'80'
|
host
|
':80'
|
origin
|
':80'
|
pathname
|
'/pathname'
|
search
|
'?search=terms'
|
hash
|
'#hash'
|
Instance Properties
hash : String
The hash portion of Location. This is the '#'
and everything following it. Use the window.onhashchange
event to listen for changes to the hash.
Example:
RunResults:
host : String
href : String
The concatenation of all parts of the Location into one string. You can set href
to cause the browser
to navigate to a new location.
Example:
RunResults:
origin : String
port : String
The port of the current Location. May be ''
if the port is the not specified in the Location.
Example:
RunResults:
Instance Methods
Copyright © PUBLIC Contributors