角度应用程序中manifest.json中的start_url应该是什么。
{
"name": "dummy",
"short_name": "dummy",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
应该是“/”ot“。”或“/index.html” 我是否需要为服务工作者听“beforeinstallprompt”事件? 或任何其他,如果我错过任何东西。 提前谢谢!
答案 0 :(得分:0)
当您在添加到主屏幕后单击PWA的图标时,开始URL将成为您应用的主页。如果您在项目的根目录中有一个index.html并且在同一路径中有一个清单,则可以提供“/index.html”,或者您也可以提供一个完全合格的uRL,其域名如“https://www.example.com/
您需要先监听beforeinstallprompt,以显示“添加到主屏幕”安装横幅。无论您如何处理此事件,您都可以从chrome菜单添加到主屏幕。此事件适用于inpage安装横幅。