【发布时间】:2019-10-11 11:53:47
【问题描述】:
我有一个用于移动浏览器的非常简单的“添加到主屏幕”工具,因此他们可以将网站添加到移动主屏幕。
manifest.json
{
"short_name": "Voetbal",
"name": "Voetbalpoule",
"icons": [
{
"src": "/voetbal/icon-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/voetbal/icon-512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/voetbal/?source=app2homescreen",
"background_color": "#ED008C",
"display": "standalone",
"orientation": "portrait",
"scope": "/voetbal/",
"theme_color": "#3367D6"
}
service-worker.js
/*
window.addEventListener("beforeinstallprompt", ev => {
// Stop Chrome from asking _now_
ev.preventDefault();
// Create your custom "add to home screen" button here if needed.
// Keep in mind that this event may be called multiple times,
// so avoid creating multiple buttons!
myCustomButton.onclick = () => ev.prompt();
});
*/
self.addEventListener('fetch', function(event) {});
这几个月来一直运行良好,但最近几天我从用户那里听说他们在单击主屏幕上的图标后会出现白屏。
我自己复制了这个,事实上,当我从主屏幕删除这个按钮并使用 Chrome 访问网站时,我会在屏幕底部看到“添加到主屏幕”按钮。 我添加了这个,然后我去我的主屏幕并点击这个按钮,然后我得到一个白屏......
这在过去几天一直运行良好,那么 Google 是否有更新?
知道为什么会出现白屏吗?
亲切的问候,
【问题讨论】:
标签: google-chrome service-worker homescreen