【问题标题】:Why has my WebAPK "Add to homescreen" suddenly stopped working and gives a white screen?为什么我的 WebAPK“添加到主屏幕”突然停止工作并出现白屏?
【发布时间】: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


    【解决方案1】:

    问题解决了!

    我发现一个 PHP 脚本错误导致了这个白屏,所以不是 WebAPK 导致了这个问题,而是一个 PHP 类型错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-23
      • 1970-01-01
      • 2015-06-21
      • 2021-06-22
      • 2012-01-11
      • 1970-01-01
      • 1970-01-01
      • 2021-05-17
      相关资源
      最近更新 更多