Meta Tag “apple-mobile-web-app-capable” for Androi

2019-02-01 08:05发布

Is there a way to create an Android Web Application like on the iPhone?

Using the "apple-mobile-web-app-capable" meta tag in the head element of an HTML page, it informs the Apple iOS that the application can be installed to the users springboard so that it starts the Safari Mobile browser without a menu bar.

5条回答
做自己的国王
2楼-- · 2019-02-01 08:20

Chrome on Android now supports a meta-tag mobile-web-app-capable:

Since Chrome M31, you can set up your web app to have an application shortcut icon added to a device's homescreen, and have the app launch in full-screen "app mode" using Chrome for Android’s "Add to homescreen" menu item.

For details about the mobile-web-app-capable meta-tag, scroll down to "Supporting homescreen-installed apps prior to M39":

Since M31, Chrome will look for the following meta tag in the element of the web-page (if there's a manifest with display specified, this is ignored):

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

The name attribute MUST be "mobile-web-app-capable" and the content attribute must be "yes" (case in-sensitive). If there is any other value in the content attribute the web app will be added as a regular bookmark.

While I don't have any devices running Chrome M31 that I could test with, I interpret this to mean that full-screen web apps, with an icon on the device's homescreen, are supported as far back as Chrome M31, provided you use that mobile-web-app-capable meta tag.

查看更多
放荡不羁爱自由
3楼-- · 2019-02-01 08:20

Since Chrome31+ home screen web apps are also supported on Android. See here.

查看更多
smile是对你的礼貌
4楼-- · 2019-02-01 08:27

Use jQuery, you can see if the height of the content is greater than the viewport height. If not, then you can make it that height.

$(document).ready(function() { 
  if (navigator.userAgent.match(/Android/i)) { 
    window.scrollTo(0,0); // reset in case prev not scrolled   
    var nPageH = $(document).height(); 
    var nViewH = window.outerHeight; 
    if (nViewH > nPageH) { 
      nViewH -= 250; 
      $('BODY').css('height',nViewH + 'px'); 
    } 
    window.scrollTo(0,1); 
  } 

}); 

Credit to meagar: Removing address bar from browser (to view on Android)

查看更多
孤傲高冷的网名
5楼-- · 2019-02-01 08:28

I don't believe so.

However, it would be fairly trivial to detect if a browser is an Android device, and show a link to a Android Market app (or directly to the APK)

As Android has a WebView widget, it's pretty trivial to write an app that loads a dedicated website, or that somehow wraps offline content (either downloaded at first-launch, or shipped in the assets folder)

查看更多
手持菜刀,她持情操
6楼-- · 2019-02-01 08:29

You can create shortcuts to bookmarks (=any web page) on the homescreen.

查看更多
登录 后发表回答