Howto remove the location hash without causing the page to scroll
Set the hash to a dummy hash which doesn't hit any id at your page, for example:
window.location.hash = "_";
Note
- If you'd set the hash to
""it causes the page to scroll to the top because the hash"#"by itself is equivalent to"_top". - If you'd set
window.location.href = "..."to get rid of the "#", you cause the browser to reload the page what is most likely not intended.