Clear Portal Filters in Local Storage

I’m experiencing a situation in the Custom Portal where the browser is holding filter values when I close the portal and return later. These values are being passed to other pages/dashboards and causing usability issues. Is there a way to prevent local storage from holding url filter parameters after leaving and returning to the portal?

This can be done with javascript in an HTML block on the page(s) where you want the filters to be reset. Here is an example script that removes values for a local storage variable named zuar.cp.appliedFilters:

    var localVariableFilter = "zuar.cp.appliedFilters"; // local storage variable name
    var filters = localStorage.getItem(localVariableFilter).replace(/['"]+/g, ''); // get local storage variable / remove all double quotes
    // when local storage value exists, clear value(s) and refresh page without parameters
    if(filters) {
1 Like

@benzuar Is there a reason for all the extra JavaScript logic?

You can simply do this to remove the filters in local storage:


For example, a filter is set in the Custom Portal: type=page-nav


Setting a new filter in the Custom Portal recreates the zuar.cp.appliedFilters key in local storage.