Skip to content

Instantly share code, notes, and snippets.

@samin
Last active December 15, 2015 04:59
Show Gist options
  • Save samin/5205481 to your computer and use it in GitHub Desktop.
Save samin/5205481 to your computer and use it in GitHub Desktop.
Hide address bar from iPhone and Android browser
if (((/iphone/gi).test(navigator.userAgent) || (/ipod/gi).test(navigator.userAgent)) &&
(!("standalone" in window.navigator) && !window.navigator.standalone)) {
offset = 60;
$('body').css('min-height', (window.innerHeight + offset) + 'px');
setTimeout( function(){ window.scrollTo(0, 1); }, 1 );
}
if ((/android/gi).test(navigator.userAgent)) {
offset = 56;
$('html').css('min-height', (window.innerHeight + offset) + 'px');
setTimeout( function(){ window.scrollTo(0, 1); }, 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment