Skip to content

Instantly share code, notes, and snippets.

@mhammonds
Created September 3, 2011 03:23
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save mhammonds/1190492 to your computer and use it in GitHub Desktop.
Save mhammonds/1190492 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 );
@2dbctapp
Copy link

on my web app i want to hide the address bar on the next page. if i use this code where would i put within my code

@harshamv
Copy link

does this work still?

@LeMikaelF
Copy link

Broken in iOS 7 with Safari.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment