How to remove the hash from window.location (URL) with JavaScript without page refresh?

I have URL like: http://example.com#something, how do I remove #something, without causing the page to refresh?

I attempted the following solution:

window.location.hash="";

However, this doesn’t remove the hash symbol # from the URL.

17 Answers
17

Leave a Comment