Skip to content

24 ways to impress your friends

Vote up?


Thanks Scott for this timely article. I’m just finishing a mobile version of a new website (mea culpa, not mobile-first approach, not responsive either) and I’ve implemented it that way.

If one’s heading for iOS and Android support, the following is enough:

/* Hides mobile browser’s address bar… */
function hideAddressBar()
{ if(!window.location.hash && !window.pageYOffset) setTimeout( function(){ window.scrollTo(0, 1); }, 50 );

/* when page is done loading… */
window.addEventListener(‘load’, hideAddressBar);
/* … or rotating */
window.addEventListener(‘orientationchange’, hideAddressBar);

Your code is way more complete, especially to support other platforms.