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

Location search Property

Location search Property

Location Object Reference Location object


Definition and Usage

The search property is a readable and writable string that sets or returns the query part of the current URL (the part after the question mark ?).

Syntax

location.search


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the search property.


Example

Example

Return the query part of the URL. Assume the current URL is http://www.runoob.com/submit.htm?email=someone@ example.com:

The output of the above example is:

?email=someone@example.com


Location Object Reference Location object