I have URL like: http://example.com#something, how do I remove #something, without causing the page to refresh?
http://example.com#something
#something
I attempted the following
function removeLocationHash(){ var noHashURL = window.location.href.replace(/#.*$/, ''); window.history.replaceState('', document.title, noHashURL) } window.addEventListener("load", function(){ removeLocationHash(); });