博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
渐进式web应用程序_如何在渐进式Web应用程序中添加到主屏幕
阅读量:2519 次
发布时间:2019-05-11

本文共 3561 字,大约阅读时间需要 11 分钟。

渐进式web应用程序

添加到主屏幕 (Add To Homescreen)

Here the web app install banner is focused on web app, with the feature of add to homescreen.

在此,Web应用程序安装标语专注于Web应用程序,具有添加到主屏幕的功能。

浏览器对“添加到主屏幕”的支持 (Browser Support for Add To Homescreen)

Add to Homescreen functionality is currently supported by:

当前受“添加到主屏幕”功能的支持:

  • Chrome

    Chrome
  • iOS Safari

    iOS Safari

You can see the latest status of browser support of this feature .

您可以在该功能的浏览器支持的最新状态。

在Android上 (On Android)

On Android, the “add to homescreen” banner comes up automatically if you meet certain requirements. This is what it should look like on Android:

在Android上,如果您满足某些要求,则会自动显示“添加到主屏幕”横幅。 这是在Android上的外观:

Add to homescreen promptWhen app launched

添加到主屏幕提示应用启动时

要求 (Requirements)

include a manifest.json file with the following properties:

包含具有以下属性的manifest.json文件:

  • short name

    short name

  • name

    name

  • 192x192 size of png icon

    192x192大小的png图标

  • start_url

    start_url

  • include a service worker that is both registered and activated

    包括已注册和激活的服务人员
  • the website served over HTTPS (you can still try this with localhost without HTTPS)

    该网站通过HTTPS提供服务(您仍然可以在没有HTTPS的情况下使用localhost尝试此操作)
  • the website meets engagement heuristics defined by Chrome

    该网站符合Chrome定义的互动启发法

manifest.json (manifest.json)

{  "name": "FreeCodeCamp",  "short_name": "FreeCodeCamp",  "theme_color": "#00FF00",  "background_color": "#00FF00",  "display": "standalone",  "Scope": "/",  "start_url": "/",  "icons": [    {      "src": "assets/images/icons/icon-72x72.png",      "sizes": "72x72",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-96x96.png",      "sizes": "96x96",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-128x128.png",      "sizes": "128x128",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-144x144.png",      "sizes": "144x144",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-152x152.png",      "sizes": "152x152",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-192x192.png",      "sizes": "192x192",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-384x384.png",      "sizes": "384x384",      "type": "image/png"    },    {      "src": "assets/images/icons/icon-512x512.png",      "sizes": "512x512",      "type": "image/png"    }  ],  "splash_pages": null}
  • name is the name of the web app. (It will be shown in the launch screen)

    name是网络应用程序的名称。 (它将显示在启动屏幕中)

  • short name is the short name of the web app. (It will be shown below the icon of phone menu)

    short name是Web应用程序的简称。 (它将显示在电话菜单图标下方)

  • theme_color is the color of the top of the browser.

    theme_color是浏览器顶部的颜色。

  • background_color is the background color of the launch screen.

    background_color是启动屏幕的背景色。

  • display is the way the web app should display once launched on the phone.

    display是网络应用在手机上启动后应显示的方式。

  • start_url define the starting url of the website.

    start_url定义网站的起始URL。

  • icons is an array that store all the images location, sizes and type.

    icons是一个数组,用于存储所有图像的位置,大小和类型。

在其他设备上 (On other devices)

Although this method does not work on iOS and Windows, there is a fallback method.

尽管此方法在iOS和Windows上不起作用,但是有一个备用方法。

的iOS (iOS)

On iOS, the “add to homescreen” button must be added manually. Add the following meta tags to the head section of your HTML to support iOS web app icon.

在iOS上,必须手动添加“添加到主屏幕”按钮。 将以下元标记添加到HTML的头部,以支持iOS Web应用程序图标。

视窗 (Windows)

On windows phone, add the following meta tags to the head section of your HTML:

在Windows Phone上,将以下元标记添加到HTML的头部:

翻译自:

渐进式web应用程序

转载地址:http://umrwd.baihongyu.com/

你可能感兴趣的文章
BiTree
查看>>
5个基于HTML5的加载动画推荐
查看>>
水平权限漏洞的修复方案
查看>>
静态链接与动态链接的区别
查看>>
Android 关于悬浮窗权限的问题
查看>>
如何使用mysql
查看>>
linux下wc命令详解
查看>>
敏捷开发中软件测试团队的职责和产出是什么?
查看>>
在mvc3中使用ffmpeg对上传视频进行截图和转换格式
查看>>
python的字符串内建函数
查看>>
Spring - DI
查看>>
微软自己的官网介绍 SSL 参数相关
查看>>
Composite UI Application Block (CAB) 概念和术语
查看>>
64位MATLAB和C混合编程以及联合调试
查看>>
原生js大总结二
查看>>
PHP基础
查看>>
UVa 11488 超级前缀集合(Trie的应用)
查看>>
Django 翻译与 LANGUAGE_CODE
查看>>
[转]iOS教程:SQLite的创建数据库,表,插入查看数据
查看>>
【转载】OmniGraffle (一)从工具栏开始
查看>>