javascript – How to hide the address bar of a webpage in android?-ThrowExceptions

Exception or error:

Possible Duplicate:
Removing address bar from browser (to view on Android)

I’m trying to run a web-based application in Android, and I want to hide the webpage address bar while running the application. Is that possible? How do I do it?

How to solve:

Executing this JavaScript on document load will scroll the browser down so that the address bar is off screen:

window.scrollTo(0, 1);

That’s probably as good as you’re going to get without writing a native Android app with a WebView to display your webapp in.

Note that this only works for the old default Android browser. It does not work with Chrome.


You don’t need to use Javascript at all, the Android browser is WebKit based. Adding the following lines

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

in the <head> portion of your page will give the desired result.


You’ll need to add your own WebView. Basic help here :

Really, don’t forget shouldOverrideUrlLoading() which will redirect all your click in your webview instead of the default browser.

Leave a Reply

Your email address will not be published. Required fields are marked *