新冢狐的白柏狐

为网站添加PWA功能及PWA访问提示

为网站添加PWA功能

首先添加 manifest.json

{
  "name": "Progressive Web App",
  "short_name": "PWA",
  "start_url": "/?from=homescreen",
  "icons": [
    {
      "src": "/static/img/icons/android-chrome-192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    }, {
      "src": "/static/img/icons/android-chrome-512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ],
  "display": "standalone",
  "background_color": "#ffffff",
  "theme_color": "#1976d2"
}

然后在站点的 中通过 link 标签引入该文件

<link rel="manifest" href="https://path/to/manifest.json">

相关文档

原文链接:https://blog.kaygb.com/735.html
PWA 应用实战:https://lavas-project.github.io/pwa-book/

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »