Search.../

remove( )

Removes query parameters from the current page's URL.

Description

Removes one or more query parameters to the current page's URL.

If a specified key does not exist as a query parameter, it is ignored.

Calling the remove() function triggers the onChange() event handler if it has been registered.

Note: To retrieve the page's current query parameters, use the query property.

Syntax

function remove(toRemove: Array<string>): void

remove Parameters

NAME
TYPE
DESCRIPTION
toRemove

Array<string>

List of keys to remove.

Returns

This function does not return anything.

Return Type:

void

Related Content:

Was this helpful?

Remove query parameters from the URL

Code Example

Copy Code
1import wixLocation from 'wix-location';
2
3// ...
4
5wixLocation.queryParams.remove(["key1"]);
6
7// URL before removal:
8// www.mysite.com/page?key1=value1&key2=value2
9
10// URL after removal:
11// www.mysite.com/page?key2=value2