public
Last active

Hide Browser Address Bar - Android + iPhone

  • Download Gist
HideMobileAddressBar.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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 );

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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.