URLSearchParams.delete()

The delete() method of the URLSearchParams interface deletes the given search parameter and all its associated values, from the list of all search parameters.

Note: This feature is available in Web Workers.

Syntax

URLSearchParams.delete(name)

Parameters

name
The name of the parameter to be deleted.

Return value

Void

Examples

let url = new URL('https://example.com?foo=1&bar=2&foo=3');
let params = new URLSearchParams(url.search.slice(1));

// Delete the foo parameter.
params.delete('foo'); //Query string is now: 'bar=2'

Specifications

Specification Status Comment
URL
The definition of 'delete()' in that specification.
Living Standard Initial definition.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
deleteChrome Full support 49Edge Full support 17Firefox Full support 29IE No support NoOpera Full support 36Safari Partial support Partial
Notes
Partial support Partial
Notes
Notes Removing a non-existent query parameter doesn't remove ? from the URL. See bug 193022.
WebView Android Full support 49Chrome Android Full support 49Firefox Android Full support 29Opera Android Full support 36Safari iOS Partial support Partial
Notes
Partial support Partial
Notes
Notes Removing a non-existent query parameter doesn't remove ? from the URL. See bug 193022.
Samsung Internet Android Full support 5.0

Legend

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
See implementation notes.