问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/43277174/web-app-manifest-not-parsed-by-chrome-dev-tools