function setQueryStringParameter(name, value) { const params = new URLSearchParams(window.location.search); params.set(name, value); window.history.replaceState({}, "", decodeURIComponent(`${window.location.pathname}?${params}`)); }