Search.../

queryParams

Gets an object used to manage the query segment of the current page's URL.

Type:

QueryParamsRead Only

Was this helpful?

Add query parameters to the URL

Code Example

Copy Code
1import wixLocation from 'wix-location';
2
3// ...
4
5wixLocation.queryParams.add({
6 "key2": "value2new",
7 "key3": "value3"
8});
9
10// URL before addition:
11// www.mysite.com/page?key1=value1&key2=value2
12
13// URL will look like:
14// www.mysite.com/page?key1=value1&key2=value2new&key3=value3
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