Created
July 21, 2016 08:28
-
-
Save z2015/a640ae25d2cb6ea3fedba54f1b56bd60 to your computer and use it in GitHub Desktop.
Prevent automatic browser scroll on refresh
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
$(window).on('unload', function() { | |
$(window).scrollTop(0); | |
}); | |
window.onunload = function(){ window.scrollTo(0,0); } | |
if ('scrollRestoration' in history) { | |
history.scrollRestoration = 'manual'; | |
} | |
//http://stackoverflow.com/questions/18617367/disable-browers-auto-scroll-after-a-page-refresh | |
//http://stackoverflow.com/questions/7035331/prevent-automatic-browser-scroll-on-refresh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment