我正在尝试在此处构建渐进式Web应用程序:https://121eddie.github.io。这涉及到
以下manifest.json由https://manifest-validator.appspot.com/验证。
{
"name": "Determiner ma position et la partager",
"short_name": "PositionWeb",
"start_url": "/index.html",
"homepage_url":"https://121eddie.github.io/",
"display": "standalone",
"description": "Une application Web Progressive qui permet de connaitre sa position et de la telecharger ou partager, meme en mode offline",
"lang": "fr-FR",
"scope": "/",
"background_color": "lightyellow",
"theme_color": "lightgreen",
"permissions": [
"geolocation",
"fileSystem",
"fileSystem.write",
"notifications"
],
"icons": [{"src": "icon200.png","sizes": "200x200","type": "image/png"},
{"src": "icon512.png","sizes": "512x512","type": "image/png"}
]
}
使用
加载到index.html中 <link rel="manifest" href="manifest.json">
然而,在Google Chrome浏览器上我得到了
SytaxError: unexpected token in JSON on position 0
错误在哪里?
更新
我改进了以下几个方面
解决方案
阻止Notepad ++在第一个括号
之前自动添加空格答案 0 :(得分:1)
答案 1 :(得分:-1)
这是编辑器:即使在utf-8中保存,记事本也会在第一个Bracket&#34; {&#34;之前添加一个空格,从而使代码无效。小心选择JSON编辑器吧!