Name
Location — represents and controls browser location
Availability
Client-side JavaScript 1.0; enhanced in JavaScript 1.1
Synopsis
location
window.location
Properties
The properties of a Location object refer to the various portions of a URL.
- hash
The anchor specification of the current URL.
- host
The hostname and port portions of the current URL.
- hostname
The hostname portion of the current URL.
- href
The complete currently displayed URL.
- pathname
The path portion of the current URL.
- port
The port portion of the current URL.
- protocol
The protocol portion of the current URL.
- search
The query portion of the current URL.
Methods
- reload(force)
Reload the current document. JavaScript 1.1.
- replace(url)
Replace one displayed document with another. JavaScript 1.1.
Get Webmaster in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.