简体   繁体   中英

How to hide address bar in android phonegap without using the domain whitelist?

谁能告诉我如何在android phonegap中隐藏地址栏。我正在尝试捕获图像,但是图像功能在phonegap中不起作用。在浏览器中同样起作用。所以,我想隐藏地址酒吧?

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);
});

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

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.

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" />

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

or with using ChildBrowser PhoneGap plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM