In order to update the query string of an URL without reloading the page, we can use the history.pushState() method.
This method receives 3 parameters (state, title, url), only the last matter for this post
const url = new URL(window.location);
url.searchParams.set('podcast', 'ninjaDevCast');
window.history.pushState({}, '', url);
Execute the code above in your browser console in order to see it working.
Opmerkingen