Created
August 27, 2014 14:35
-
-
Save miguelgr/4fe74bcb040335e8d8d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if (window.location.hash && window.location.hash == '#_=_') { | |
if (window.history && history.pushState) { | |
window.history.pushState("", document.title, window.location.pathname); | |
} else { | |
// Prevent scrolling by storing the page's current scroll offset | |
var scroll = { | |
top: document.body.scrollTop, | |
left: document.body.scrollLeft | |
}; | |
window.location.hash = ''; | |
// Restore the scroll offset, should be flicker free | |
document.body.scrollTop = scroll.top; | |
document.body.scrollLeft = scroll.left; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment