Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

The toString() method of the URLSearchParams interface returns a query string suitable for use in a URL.

Note: This method returns the query string without the question mark. This is different from, which includes it.

Note: This feature is available in Web Workers.




A DOMString, without the question mark.


let url = new URL('');
let params = new URLSearchParams(;

//Add a second foo parameter.
params.append('foo', 4);
//Prints 'foo=1&bar=2&foo=4'

// note: params can also be directly created
let url = new URL('');
let params = url.searchParams;

// or even simpler
let params = new URLSearchParams('foo=1&bar=2');


Specification Status Comment
The definition of 'toString() (see "stringifier")' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
toStringChrome Full support 49Edge Full support 17Firefox Full support 29IE No support NoOpera Full support 36Safari Full support YesWebView Android Full support 49Chrome Android Full support 49Edge Mobile No support NoFirefox Android Full support 29Opera Android Full support 36Safari iOS Full support YesSamsung Internet Android Full support Yes


Full support  
Full support
No support  
No support

See also

Étiquettes et contributeurs liés au document

Dernière mise à jour par : mdnwebdocs-bot,