The searchParams readonly property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.

Note: This feature is available in Web Workers.


var urlSearchParams = URL.searchParams;


URLSearchParams object.


If the URL of your page is https://example.com/?name=Jonathan%20Smith&age=18 you could parse out the 'name' and 'age' parameters using:

let params = (new URL(document.location)).searchParams;
let name = params.get('name'); // is the string "Jonathan Smith".
let age = parseInt(params.get('age')); // is the number 18


Specification Status Comment
The definition of 'searchParams' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
searchParamsChrome Full support 51Edge Full support 17Firefox Full support 29IE No support NoOpera Full support YesSafari Full support 10WebView Android Full support 51Chrome Android Full support 51Firefox Android Full support 29Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 5.0


Full support  
Full support
No support  
No support