我为移动浏览器提供了一个非常简单的“添加到主屏幕”工具,因此他们可以将网站添加到移动主屏幕。
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有更新吗?
知道为什么我会出现白屏吗?
亲切的问候,
我有一个非常简单的“添加到主屏幕”工具,用于移动浏览器,因此他们可以将网站添加到移动主屏幕。 manifest.json {“ short_name”:“ Voetbal”,“ name”:“ Voetbalpoule”,“ icons”:...
问题已解决!