添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I notice the w3c spec mentions manifest.webmanifest yet I see Google and Firefox and other browsers say to use manifest.json

Simple question: Should we use both or just pick one? ~As I can't find the answer in the spec. Plus the spec doesn't mention manifest.json either which seems strange.

(I been using the .json and seen no problems for several years, just wondered if I should add both).

Thanks.

boghyon, SuporteWebGerente, fallaciousreasoning, Krinkle, yilkur, and Hibrix-net reacted with thumbs up emoji toastal reacted with thumbs down emoji All reactions

Note that the actual name (including the extension) are totally irrelevant, as long as you serve it with application/json (perhaps it doesn't even matter if you serve it with application/json). However, manifest.json is far more likely to be served with a correct MIME type, so I would be in favour of converting all documentation over to recommend that.

Edit: Whoa I just noticed the Media type registration section, which registers:

  • The MIME type application/manifest+json .
  • The file extension .webmanifest .
  • It RECOMMENDS (but does not REQUIRE) that the manifest be served with application/manifest+json . I was going to quickly update our docs, but it looks like there is a deeper issue if there is a normative RECOMMENDATION.

    Questions:

  • Do many popular web sites serve their manifest with application/manifest+json ?
  • Do any major web servers serve *.webmanifest files with MIME type application/manifest+json ?
  • Do any web browsers treat application/manifest+json any differently to application/json ?
  • If the answer to all of the above is "no" (which I suspect it is), then perhaps we should consider removing this, and just using the .json file extension and application/json MIME type for manifests. We probably can't really delete any of this text, since legacy servers and sites may be serving application/manifest+json and/or expecting .webmanifest to map onto application/manifest+json . However, we could mark it deprecated, and change " the media type for a manifest " to application/json .

    I've been using manifest.webmanifest with a application/manifest+json MIME type for a while , because:

  • that's what I saw recommended (I don't remember where) when I created it
  • it allows me to use a different Expire header for manifests and other JSON files
  • OK, I'm convinced that we should leave this. However, I think we should put application/json on equal footing with application/manifest+json (so user agents should be happy if the web server serves the manifest as either type). While a web server itself is allowed to serve using application/manifest+json and use that internally to configure other things like expire time.

    Edit: I still think we could update the examples to use manifest.json since that is probably the easiest thing to configure (most web servers will likely serve manifest.json as application/json but manifest.webmanifest as text/plain or application/octet-stream ).

    In the spec, under "Security and privacy considerations" it says:

    [...] because there is no way to prevent developers from including custom/unrestrained data in a manifest, implementors need to impose their own implementation-specific limits [...]

    So there may also be security related implications from serving a manifest with application/manifest+json rather than application/json .

    Going to close this as its old now and add a Summary:

    The following methods are fine:

    <link rel="manifest" href="/manifest.json">
    <link rel="manifest" href="/manifest.webmanifest">

    Both must have the MIME type: application/manifest+json

    [Bug] The hint for hint-manifest-file-extension should allow .json file extension and should check for the MIME type webhintio/hint#2877

    To be clear, any file extension can be used - or no file extension at all. It’s polite to send the right mime type, but what matters is that the body of the response is JSON. However, if a file extension must be used, .webmanifest remains the standard one.

    We can add more guidance if you think it’s warranted.

    I've personally being using .webmanifest since I thought that is what is the correct choice, as discussed in the link below.

    https://developer.mozilla.org/en-US/docs/Web/Manifest