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);
// Delete the foo parameter.
params.delete('foo'); //Query string is now: 'bar=2'
Specifications
Specification | Status | Comment |
---|---|---|
URLThe definition of 'delete()' in that specification. | Living Standard | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
delete
|
Chrome
Full support 49 |
Edge
Full support 17 |
Firefox
Full support 29 |
IE
No support No |
Opera
Full support 36 |
Safari Partial support Partial Partial support Partial Notes' Removing a non-existent query parameter doesn't remove |
WebView Android
Full support 49 |
Chrome Android
Full support 49 |
Firefox Android
Full support 29 |
Opera Android
Full support 36 |
Safari iOS Partial support Partial Partial support Partial Notes' Removing a non-existent query parameter doesn't remove |
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.
URLSearchParams.delete() by Mozilla Contributors is licensed under CC-BY-SA 2.5.