html - 渐进式 Web 应用程序未在浏览器栏中显示安装按钮

标签 html progressive-web-apps

我正在尝试制作 PWA并且似乎没有任何东西可以使安装为 Web 应用程序按钮出现在我的网站上。

安装按钮如下所示,并显示在地址栏中:

enter image description here

当我去一个话语网站而不是我自己的网站时,它就会出现。

我脑子里有以下内容:

我的 list 位于根目录中,名为 manifest.webmanifest:

{
  "name": "Example 1",
  "short_name": "example1",
  "display": "standalone",
  "start_url": ".",
  "background_color": "#000000",
  "theme_color":"#ffffff",
  "description": "Example web app.",
  "icons": [{
    "src": "https://www.example.com/test/images/icon_512.png",
    "sizes": "512x512",
    "type": "image/png"
  }],
  "share_target": {
    "action":"/new-topic",
    "method":"GET",
    "enctype":"application/x-www-form-urlencoded",
    "params": {
      "title":"title",
      "text":"body"}
  }
}

现在控制台中没有错误。起初有一个错误说它找不到 Logo 图像。一旦该路径正确,错误就消失了,但仍然没有安装按钮。

PWA 的一个例子是 discourse.org 论坛 here .这个网站安装得很好。

在 Brave/Firefox/OS X 中测试

MDN Progressive Web

更新(找到):
Net Ninja Course on PWAs

最佳答案

我使用 Chrome Inspector 来调试我的网络应用 list :
https://developers.google.com/web/tools/chrome-devtools/progressive-web-apps
例如,它显示了我的 manifest.json 中的问题:
enter image description here
修复问题后,Chrome 地址栏上会出现 PWA 安装图标 :)

关于html - 渐进式 Web 应用程序未在浏览器栏中显示安装按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58985103/

相关文章:

angular - 无法使用 Angular cli 以 Angular 注册服务 worker

javascript - Firestore 无法工作 似乎可以离线工作

html - 并排显示两个 <div>

javascript - 如何以与单击按钮并按 'enter' 相同的方式提交表单

javascript - 如何用 JavaScript 改变音调?

reactjs - 更改 index.html 时强制更新已安装的 PWA(防止缓存)

javascript - 输入无效时显示工具提示/消息 HTML/JS/CSS/Angularjs

html - 将特定 URL 重定向到 404

google-chrome - 为什么每次打开 PWA 时都会出现 "Tap to copy the URL for this app"通知

android - 如何在渐进式 Web 应用程序中使用自适应启动器图标