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
This will remove the trailing hash as well. eg: http://test.com/123#abc -> http://test.com/123
if(window.history.pushState) { window.history.pushState('', '/', window.location.pathname) } else { window.location.hash = ''; }