Last active
September 21, 2015 18:29
-
-
Save arturparkhisenko/af2c95081e6e523dc71d to your computer and use it in GitHub Desktop.
remove hash from url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//source: http://stackoverflow.com/questions/4508574/remove-hash-from-url | |
//Best is Homero Barbosa's answer below: | |
history.pushState('', document.title, window.location.pathname); | |
//... or, if you want to maintain the search parameters: | |
history.pushState('', document.title, window.location.pathname + window.location.search); | |
//Old, do not use, badwrongfun: | |
// var loc = window.location.href, | |
// index = loc.indexOf('#'); | |
// if (index > 0) { | |
// window.location = loc.substring(0, index); | |
// } | |
//that refreshes the page for you which seems a trifle rude after | |
//just arriving there. Grin and bear it seems to be the best option. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment