Skip to content

.webmanifest

Pooya Parsa edited this page Mar 12, 2020 · 7 revisions
Clone this wiki locally

The workbox submodule, generates a special file called manifest.json and adds it to the page. According to W3 working draft:

This specification defines a JSON-based manifest file that provides developers with a centralized place to put metadata associated with a web application. This metadata includes, but is not limited to, the web application's name, links to icons, as well as the preferred URL to open when a user launches the web application. The manifest also allows developers to declare a default orientation for their web application, as well as providing the ability to set the display mode for the application (e.g., in fullscreen). Additionally, the manifest allows a developer to "scope" a web application to a URL. This restricts the URLs to which the manifest is applied and provides a means to "deep link" into a web application from other applications.

Although the (draft) spec recommends using .webmanifest, it is not required to have any specific extension (or even extension at all). There are several reasons that at least PWA module sticks with .json format. This may be changed in the future but this wiki tries to clarify why we are using .json extension as default and recommended for now.

Why .json

  • It is widely adopted and being preferred by current noticeable PWAs including Tweeter
  • Recommended by Google
  • Some webservers (including IIS) do not serve unknown extensions and/or not supporting application/manifest+json mime type so this makes risks as less as possible for all users
  • It is valid by spec!

Why .webmanifest

We plan to add a feature flag to change the extension. This allows:

  • Having an option for users that concern to follow spec recommended rules as well
  • Recommended by webhint
  • Fix issues with tools that alert about the extension
  • Prepare for the future when the extension was also widely adopted
  • If webserver needs to change/differ cache policy based on MimeType

Users can then ensure that their deployment and server support this extension and opt-in.

Related Issues