- 我正在尝试将manifest.json文件链接到我创建的网站,以将其转换为PWA。已使用
html/css
和python flask
作为后端李> - 我不知道这是路径问题还是其他问题。服务人员被检测到,工作绝对正常李>
- 但在应用程序清单中,我得到的错误清单不是有效的JSON。行:1,列:1,意外标记
manifest.json
文件
{
"name": "Flask-PWA",
"short_name": "Flask-PWA",
"description": "A progressive webapp template built with Flask",
"theme_color": "transparent",
"background_color": "transparent",
"display": "standalone",
"orientation": "portrait",
"scope": "/",
"start_url": "../templates/login_user.html",
"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"
}
]
}
Tags:
更改内容类型
检查开发人员控制台中的网络选项卡,并查找
manifest.json
请求。如果响应的内容类型为text/html
,那么您可能需要添加一个额外的头,将路由中的Content-Type
更改为application/json
使用python对象
如果更改内容类型无效,则可以将整个清单作为python对象编写,然后
jsonify
将其返回到浏览器相关问题 更多 >
编程相关推荐