Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Location hash Property

Location hash Property

Location Object Reference Location object


Definition and Usage

The hash property is a readable and writable string that is the anchor part of the URL (the part starting with #).

Syntax

location.hash


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the hash property.


Example

Example

Return the main part of a URL. Assume the current URL is http://www.runoob.com/test.htm#PART2:

document

.

write

(

location

.

hash

)

;

The example above produces the following output:

#part2


Location Object Reference Location object