【问题标题】:How to make PWA with manifest / service-worker?如何使用 manifest / service-worker 制作 PWA?
【发布时间】:2019-10-16 09:35:13
【问题描述】:

我的 manifest.json 中有语法错误

清单:第 7 行,第 1 列,语法错误。

我正在尝试删除文件中的所有数据,但我得到了同样的错误。

看看我的 manifest.json

{
"name" : "VIDEOFUTUR",
"short_name" : "VF",
"description" : "Télécom",
"start_url" : "index.php",
"scope" : "/",
"display" : "fullscreen",
"orientation" : "any",
"lang" : "French",
"icons" : [
    {
        "src": "https://lafibrevideofutur.fr/img/favicon.png",
        "sizes": "256x256"
    }],
}

【问题讨论】:

  • 你在哪里得到这个错误?在浏览器控制台中?
  • 在浏览器控制台中是。当我在控制台中打开清单查看第 7 行时,出现此错误“Nothing to preview”

标签: json manifest progressive-web-apps


【解决方案1】:

你有没有发现icons 后面的逗号?

应该是:

{
   "name": "VIDEOFUTUR",
   "short_name": "VF",
   "description": "Télécom",
   "start_url": "index.php",
   "scope": "/",
   "display": "fullscreen",
   "orientation": "any",
   "lang": "French",
   "icons": [
      {
         "src":"https://lafibrevideofutur.fr/img/favicon.png",
         "sizes":"256x256"
      }
   ]
}

下次只需使用任何 online tool 验证您的 JSON。

【讨论】:

  • 谢谢你的回答,但我又遇到了同样的错误。我可以删除文件,但我又总是遇到同样的错误
  • 这个错误是从哪里来的?这是一个完美的网络清单。文件是否有可能以某种方式被缓存?
  • 通常是不可能的。我查看了此选项,但没有看到任何内容
  • 我刚刚在我的一个简单的index.html 中使用了该清单,它非常好,浏览器没有报告任何错误。
猜你喜欢
  • 2018-09-29
  • 2019-01-08
  • 2023-03-16
  • 2020-11-20
  • 1970-01-01
  • 1970-01-01
  • 2022-08-07
  • 2018-12-15
  • 2020-07-01
相关资源
最近更新 更多