[我正在尝试使我编写的应用程序渐进。
我遇到指向我的manifest.json文件的错误...
错误说,Line: 1, Column: 1, Unexpected Token
。
这是我的清单文件
{
"manifest_version": 2,
"name": "Blah Blah Blah",
"short_name": "Analysis App",
"theme_color": "#fddb2f",
"background_color": "#fddb2f",
"display": "standalone",
"Scope": "/",
"start_url": "/",
"version": "1",
"icons": [
{
"src": "images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}
这就是我在HTML中引用它的方式
<link rel="manifest" href="/manifest.json">
我不知道为什么会收到此错误?
有人可以帮忙吗?
非常感谢
尝试将href =“ ./ manifest.json”与“。 /
之前我遇到了同样的问题,但已解决了50%。
我从https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/测试了它的Google教程
当我在Web服务器上将其设置为带有根文件夹的chrome(选择文件夹= Current / pwa_weather)时,它可以100%工作。我可以像https://localhost:8888一样访问它。
但是,当我通过https://xxxx.azurewebsites.net/pwa_weather之类的访问权限将其设置为Azure时,则不起作用。
我断定menifest.json必须位于Web根文件夹中。我什至没有用utf8bom文件格式修改manifest.json。另外,使用绝对路径(如。,>)修改index.html