Window location.search
Definition and Usage
The search property returns the querystring part of a URL, including the question mark (?).
The search property can also be used to set the querystring.
Note
The querystring part is the part of the URL after the question mark (?).
The querystring is used for parameter passing.
Syntax
Return the search property:
location.search
Set the search property:
location.search = querystring
Property Value
| Parameter | Description |
| querystring | The querystring part of the URL |
Return Value
| Type | Description |
| A string | The querystring part of a URL, including the question mark (?) |
Browser Support
location.search is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | Yes |