I've got this url:
website.com/con?blog=true
What I do in javascript is:
if (getURLparams(blog)) {
RandomFunction();
// change the url
window.history.replaceState({}, '?blog=true', "blog=false");
}
However, I do not want to use blog=false
, in fact I want empty string there. I tried ""
/''
but they didn't work.
Any idea or alternative? Thanks
You can set it to location.pathname
:
window.history.replaceState({}, '', location.pathname);
This will remove the URL params.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With