Location

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

Core client-side JavaScript object.

Description

The Location object represents the current Web address displayed in the browser. The Location object has specific properties and methods associated with it, as shown in Table 7.34.

Table 7.34. Properties and Methods of the Location Object
Property/Method Description
hash Represents an anchor name in the URL that begins with the # character
host Represents the hostname and port number of the URL
hostname Represents the hostname part of the URL
href Represents the complete URL
pathname Represents the pathname part of the URL
port Represents the port part of the URL
protocol Represents the protocol part of the ...

Get Pure JavaScript 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.