Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing address bar from browser (to view on Android)

Does anyone know how I can remove the address bar from the Android browser to better view my web app and make it look more like a native app?

like image 968
sixtysticks Avatar asked Nov 01 '10 11:11

sixtysticks


People also ask

How do I make my browser full screen on Android?

Built-in Fullscreen Mode in Chrome for AndroidTapping the Menu button (three vertical dots) in the upper right-hand corner of the screen (or tap the hardware menu button on those devices having one)


2 Answers

You can do that with the next code

 if(navigator.userAgent.match(/Android/i)){     window.scrollTo(0,1);  } 

I hope it helps you!

like image 166
Carlos Avatar answered Sep 20 '22 21:09

Carlos


Here's the NON-jQuery solution that instantly removes the address bar without scrolling. Also, it works when you rotate the browser's orientation.

function hideAddressBar(){   if(document.documentElement.scrollHeight<window.outerHeight/window.devicePixelRatio)     document.documentElement.style.height=(window.outerHeight/window.devicePixelRatio)+'px';   setTimeout(window.scrollTo(1,1),0); } window.addEventListener("load",function(){hideAddressBar();}); window.addEventListener("orientationchange",function(){hideAddressBar();}); 

It should work with the iPhone also, but I couldn't test this.

like image 38
Tim Eckel Avatar answered Sep 23 '22 21:09

Tim Eckel