JavaScript » Location » hash

Syntax:
location.hash

The hash property is a string beginning with a hash (#), that specifies an anchor name in an HTTP URL.

hash is a property of both the Link and the Location objects and is a string beginning with a hash (#). It specifies an anchor name in an HTTP URL. For example, assuming the following URL to be your current window...
 
http://home.newco.com/products/enquiries.htm#local?email=name@otherco.com
 
...you could find out the hash property as follows:

NOTE:
 
Although the hash property can be set at any time, it is safer to set the href property to change a location

Examples

Code:
document.write(location.hash)
Output:
#local?email=name@otherco.com
Explanation:

...you could find out the hash property as follows: