replaceState with empty string: Javascript
You can use a relative path:
window.history.replaceState({}, '', './');
You can set it to location.pathname
:
window.history.replaceState({}, '', location.pathname);
This will remove the URL params.