如何编写我的PWA的安装提示

时间:2019-07-11 23:51:41

标签: wordpress web-services web-applications progressive-web-apps beforeinstallprompt

我无法加载安装提示并要求用户将其添加到主屏幕,我不明白将代码添加到哪个文件的位置。我正在运行一个wordpress网站。我有清单以及服务人员,但是我无法将其添加到主屏幕上以在移动设备和/或台式机上弹出。请帮助我

下面的清单代码

{
"lang": "en",
"short_name": "canvasesbegone.com",
"name": "CanvasesBeGone",
"icons": [
    {
  "src": "assets/icons/launcher-icon-1x.png",
  "type": "image/png",
  "sizes": "16x16"
},

{
  "src": "assets/icons/launcher-icon-2x.png",
  "type": "image/png",
  "sizes": "32x32"
},
    {
  "src": "assets/icons/launcher-icon-3x.png",
  "type": "image/png",
  "sizes": "48x48"
},
 {
  "src": "assets/icons/launcher-icon-4x.png",
  "type": "image/png",
  "sizes": "64x64"
},
{
  "src": "assets/icons/launcher-icon-5x.png",
  "type": "image/png",
  "sizes": "96x96"
},
{
  "src": "assets/icons/launcher-icon-6x.png",
  "type": "image/png",
  "sizes": "144x144"
},
{
  "src": "assets/icons/launcher-icon-7x.png",
  "type": "image/png",
  "sizes": "192x192"
},
{
  "src": "assets/icons/launcher-icon-8x.png",
  "type": "image/png",
  "sizes": "300x300"
},
 {
  "src": "assets/icons/launcher-icon-9x.png",
  "type": "image/png",
  "sizes": "512x512"
}
],
"start_url": "https://canvasesbegone.com/?utm_source=web_app_manifest",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#ffffff"

}

这是service-worker.js代码

self.addEventListener('fetch', function(event){

});

0 个答案:

没有答案