如何隐藏在Android的PhoneGap的地址栏中,而无需使用域名白名单?栏中、名单、地址、域名

2023-09-07 23:14:19 作者:◣墨劇,空格先生◥

谁能告诉我如何隐藏在Android phonegap.I地址栏我试图捕捉图像,但图像的功能不工作在phonegap.where一样工作在browser.So,我想隐藏地址栏?

Can anyone tell me how to hide the address bar in the android phonegap.I am trying to capture image but the image functionality is not working in the phonegap.where as the same is working in the browser.So,I want to hide the address bar?

推荐答案

是的,这可能与这个小的Javascript:

Yes, that's possible with this little Javascript:

<script type="text/javascript">
// When ready...
window.addEventListener("load",function() {
// Set a timeout...
setTimeout(function(){
  // Hide the address bar!
  window.scrollTo(0, 1);
}, 0);
});

您应该在某个地方添加了&LT; HEAD&GT; 你的HTML code

You should add it somewhere in the <head> of your HTML code.

window.scrollTo 方法的关键在于隐藏地址栏。该包装的setTimeout 功能要求的电话正常隐藏地址栏 - 不使用setTimeout的会造成问题。

The window.scrollTo method is the key to hiding the address bar. The wrapping setTimeout function is required by the Phone to properly hide the address bar – not using setTimeout will cause problems.

当你想支持添加网页在iPhone主屏幕,以及,你需要添加下面的&LT;元&GT; -tag太

When you want to support adding webpages to the homescreen on the iPhone as well, you'll need to add the following <meta>-tag too.

<meta name="apple-mobile-web-app-capable" content="yes" />

这也将隐藏工具栏在屏幕上的iPhone(添加用户到主屏幕只有当)。

This will also hide the toolbar at the bottom of the screen on the iPhone (only when added to homescreen by user).

或使用 ChildBrowser PhoneGap的插件