Possible Duplicate:
Removing address bar from browser (to view on Android)可能重复:从浏览器中删除地址栏(在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?
我正在尝试在Android中运行基于Web的应用程序,我想在运行应用程序时隐藏网页地址栏。那可能吗?我该怎么做?
3 个解决方案
#1
16
Executing this JavaScript on document load will scroll the browser down so that the address bar is off screen:
在文档加载时执行此JavaScript将向下滚动浏览器,以便地址栏不在屏幕上:
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.
如果没有使用WebView编写本机Android应用程序来显示您的webapp,那么这可能会非常好。
Edit: Note that this only works for the old default Android browser. It does not work with Chrome.
编辑:请注意,这仅适用于旧的默认Android浏览器。它不适用于Chrome。
#2
13
You don't need to use Javascript at all, the Android browser is WebKit based. Adding the following lines
您根本不需要使用Javascript,Android浏览器基于WebKit。添加以下行
<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.
在页面的部分将给出所需的结果。
#3
1
You'll need to add your own WebView
. Basic help here : http://developer.android.com/guide/tutorials/views/hello-webview.html
您需要添加自己的WebView。基本帮助:http://developer.android.com/guide/tutorials/views/hello-webview.html
Really, don't forget shouldOverrideUrlLoading()
which will redirect all your click in your webview instead of the default browser.
真的,不要忘记shouldOverrideUrlLoading(),它将重定向您的webview中的所有点击而不是默认浏览器。
#1
16
Executing this JavaScript on document load will scroll the browser down so that the address bar is off screen:
在文档加载时执行此JavaScript将向下滚动浏览器,以便地址栏不在屏幕上:
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.
如果没有使用WebView编写本机Android应用程序来显示您的webapp,那么这可能会非常好。
Edit: Note that this only works for the old default Android browser. It does not work with Chrome.
编辑:请注意,这仅适用于旧的默认Android浏览器。它不适用于Chrome。
#2
13
You don't need to use Javascript at all, the Android browser is WebKit based. Adding the following lines
您根本不需要使用Javascript,Android浏览器基于WebKit。添加以下行
<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.
在页面的部分将给出所需的结果。
#3
1
You'll need to add your own WebView
. Basic help here : http://developer.android.com/guide/tutorials/views/hello-webview.html
您需要添加自己的WebView。基本帮助:http://developer.android.com/guide/tutorials/views/hello-webview.html
Really, don't forget shouldOverrideUrlLoading()
which will redirect all your click in your webview instead of the default browser.
真的,不要忘记shouldOverrideUrlLoading(),它将重定向您的webview中的所有点击而不是默认浏览器。