How do I reload the page without the query parameters?

Let's say I want to reload www.domain.com/abc?num=4

But I want to reload www.domain.com/abc ONLY (without everything after the question mark)


window.location = window.location.href.split("?")[0];

There are a few ways to go about it:

window.location = window.location.href.split("?")[0];

Or, alternatively:

window.location = window.location.pathname;

This is the best and easiest way,

// similar to HTTP redirect
window.location.replace(location.pathname);