Chrome 开发工具未解析 Web 应用程序清单 [英] Web App Manifest not parsed by Chrome Dev Tools

查看:43
本文介绍了Chrome 开发工具未解析 Web 应用程序清单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个

有没有人遇到过类似的问题?我认为 JSON 是无效的,但是复制粘贴到 Web App Validator 它被标记为正确,但是当输入 URL 时,它给出了一个解析错误:

文件不是有效的 JSON:SyntaxError:JSON 中位置 0 的意外标记

解决方案

这可能是一个 BOM 字符<manifest.json 文件中的/a> 问题.

如果您的机器上有 Notepad++,请尝试打开文件,单击菜单编码"->在没有 BOM 的情况下以 UTF8 编码",然后保存文件.

如果您没有 Notepad++,请在 Google 中搜索您最喜欢的 IDE/编辑器的删除 BOM 字符".

I have a manifest.json according to the MDN spec and while it works correctly when browsing the website from a mobile device (add to homescreen popup shows up, theme color and icons load...etc) Chrome Dev Tools is unable to parse it. The same problem persists on Lighthouse (chrome extension).

Has anyone seen a similar issue? I would think that the JSON is invalid however copy-pasting into Web App Validator it is marked correct, but when inputting the URL it giving a parse error:

File isn't valid JSON: SyntaxError: Unexpected token in JSON at position 0

解决方案

It is probably a BOM character issue in the manifest.json file.

If you have Notepad++ on your machine, try open the file, click menu "Encoding" -> "Encode in UTF8 without BOM" and then save the file.

If you don't have Notepad++, search Google for "Remove BOM character" for your favorite IDE/editor.

这篇关于Chrome 开发工具未解析 Web 应用程序清单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆