Skip to content

Instantly share code, notes, and snippets.

@bradoyler
Created December 1, 2013 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradoyler/7728314 to your computer and use it in GitHub Desktop.
Save bradoyler/7728314 to your computer and use it in GitHub Desktop.
hack to get rid of ios address bar
// hack to get rid of ios address bar.
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