Home > widget-integration > FilterUrlHelper > deleteQueryParamHistory
FilterUrlHelper.deleteQueryParamHistory() method
Deletes a query parameter from the URL history.
Handles both shortened and full parameter names with multiple URL schemes. For URL scheme 2, also clears associated sessionStorage data.
Signature:
deleteQueryParamHistory(key: string, options?: {
preventPushHistory?: boolean;
isShortenUrlParam?: boolean;
urlScheme?: number;
}): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
string |
The query parameter key to delete (long form, e.g., 'pf_brand'). Will be automatically mapped to short key if URL shortening is enabled. |
|
options |
{ preventPushHistory?: boolean; isShortenUrlParam?: boolean; urlScheme?: number; } |
(Optional) Configuration options for URL handling |
Returns:
void
Remarks
When using URL shortening (scheme 1 or 2), automatically maps long parameter names to their shortened versions before deletion. For scheme 2, ensures both the URL parameter and sessionStorage entry are removed to prevent data leakage.
Example 1
Delete a filter parameter:
this.urlHelper.deleteQueryParamHistory('pf_brand');
// Removes pf_brand from URL and history
Example 2
Delete with shortened params:
this.urlHelper.deleteQueryParamHistory('pf_brand', false, {
isShortenUrlParam: true,
urlScheme: 2
});
// Removes short key 'b' from URL and sessionStorage