manifest.json 对比 manifest.webmanifest
manifest.json vs manifest.webmanifest
我正在使用 mongodb、Node.JS 和 PWA 开发应用程序。第一步开发不知道有什么区别manifest.json
和 manifest.webmanifest
。
除了命名,没有太大区别。使用您喜欢的任何一个:"/manifest.json"
或 href="/manifest.webmanifest"
。只是不要忘记 MIME 类型必须是:application/manifest+json
在这两种情况下。
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/manifest.webmanifest">
注意spec says应该是manifest.webmanifest
。后来它可能很重要,因为它正在大力发展。
2019 年 11 月更新
差异在MDN (Mozilla Developer Network)中提到:
The .webmanifest extension is specified in the Media type registration section of the specification (the response of the manifest file should return Content-Type: application/manifest+json). Browsers generally support manifests with other appropriate extensions like .json (Content-Type: application/json).
您可以阅读更多详细信息:Media Type Registration
就像其他答案中提到的,两者没有太大区别。
但是,根据webhint.io,建议使用manifest.webmanifest
。
manifest-file-extension
warns against using non-standard file extensions for the web app manifest file.
While the .webmanifest file extension is not enforced by the specification, nor is it required by browsers, using it makes it:
- easier to set custom server configurations for the web app manifest file
- possible to benefit from existing configurations
这也在问题面板的 Microsoft Edge 浏览器开发工具中显示为提示(下面的屏幕截图)
我正在使用 mongodb、Node.JS 和 PWA 开发应用程序。第一步开发不知道有什么区别manifest.json
和 manifest.webmanifest
。
除了命名,没有太大区别。使用您喜欢的任何一个:"/manifest.json"
或 href="/manifest.webmanifest"
。只是不要忘记 MIME 类型必须是:application/manifest+json
在这两种情况下。
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/manifest.webmanifest">
注意spec says应该是manifest.webmanifest
。后来它可能很重要,因为它正在大力发展。
2019 年 11 月更新
差异在MDN (Mozilla Developer Network)中提到:
The .webmanifest extension is specified in the Media type registration section of the specification (the response of the manifest file should return Content-Type: application/manifest+json). Browsers generally support manifests with other appropriate extensions like .json (Content-Type: application/json).
您可以阅读更多详细信息:Media Type Registration
就像其他答案中提到的,两者没有太大区别。
但是,根据webhint.io,建议使用manifest.webmanifest
。
manifest-file-extension
warns against using non-standard file extensions for the web app manifest file.While the .webmanifest file extension is not enforced by the specification, nor is it required by browsers, using it makes it:
- easier to set custom server configurations for the web app manifest file
- possible to benefit from existing configurations
这也在问题面板的 Microsoft Edge 浏览器开发工具中显示为提示(下面的屏幕截图)