Skip to content

24 ways to impress your friends

Vote up?

Dustin Hansen

That’s quite a bit of code when a little redundancy will actually accomplish the same result:

<script charset=“utf-8”>
if (!window.location.hash && window.addEventListener) {
window.addEventListener(‘load’, function() {
window.scrollTo( 0, 1 );
window.scrollTo( 0, 0 );
}, false);
}
</script>

In Android it’s already hidden the address bar due to the first scrollTo call, and resetting to 0, 0 does not reshow the address bar, but in iOS, it is reset to 0, 0 as desired.

However, that being said, I agree that should probably only be used in rare cases.