Reputation: 2377
I wan to remove parameter from URL without reloading or refreshing page.
I used below code for that, and it's working fine.
jQuery(document).ready(function($) {
window.history.pushState("", "", "/" );
});
But problem is if I click on browser back button I can see parameters in url.
Upvotes: 1
Views: 339
Reputation: 60507
That's because pushState
adds a new entry to the browser history.
Use replaceState
instead, to replace the current entry.
jQuery(document).ready(function($) {
window.history.replaceState("", "", "/" );
});
Upvotes: 7