JavaScript » Location » search

Syntax:
location.search

The search property is a string beginning with a question mark that specifies any query information in an HTTP URL.

search is a property of both the Link and the Location objects and is a string beginning with a question mark that specifies any query information in an HTTP URL. It contains one or more pairs of variables and values, separated by ampersands. Assuming your current window to be the URL...
 
http://home.newco.com/products/enquiries.htm#local?email=name@otherco.com
 
...you could find out the search property as follows:

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

Examples

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

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