Skip to content

Instantly share code, notes, and snippets.

@Arwid
Forked from mhammonds/HideMobileAddressBar.js
Created March 19, 2012 04:10
Show Gist options
  • Save Arwid/2094448 to your computer and use it in GitHub Desktop.
Save Arwid/2094448 to your computer and use it in GitHub Desktop.
Hide Browser Address Bar - Android + iPhone
function hideAddressBar()
{
if(!window.location.hash)
{
if(document.height < window.outerHeight)
{
document.body.style.height = (window.outerHeight + 50) + 'px';
}
setTimeout( function(){ window.scrollTo(0, 1); }, 50 );
}
}
window.addEventListener("load", function(){ if(!window.pageYOffset){ hideAddressBar(); } } );
window.addEventListener("orientationchange", hideAddressBar );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment