function setUrlParam(param, value) { const url = new URL(window.location.href); url.searchParams.set(param, value); window.history.pushState({}, "", url); } function deleteUrlParam(param) { const url = new URL(window.location.href); url.searchParams.delete(param); window.history.pushState({}, "", url); }