我关注了Google的first PWA tutorial并创建了自己的项目https://my-pwa-77d8a.firebaseapp.com。一切都很好看:
manifest.json
个文件<meta name="mobile-web-app-capable" content="yes">
标记的manifest.json
{
"short_name": "PizzaApp",
"name": "My delicious PWA",
"icons": [
{
"src": "img/launcher-icon-2x.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "img/launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "img/launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "/index.html",
"display": "standalone",
"orientation": "portrait"
}
我可以从手机和桌面手动添加到主屏幕。但Chrome从不显示添加到主屏幕横幅。有什么问题?
解决
如下所示,我的服务工作者正在尝试缓存丢失的offline.html
文件。我创建了文件,清除了手机的缓存,一切正常。