A Web App Manifest is a JSON file that tells the browser about your Progressive Web App and how it should behave when installed on the user's desktop or mobile device. Via the
display property, you can customize what browser UI is shown when your app is launched. For example, you can hide the address bar and browser chrome. Games can even be made to launch full screen. As a quick recap, below are the display modes that are specified at the time this article was written.
|Opens the web application without any browser UI and takes up the entirety of the available display area.|
|Opens the web app to look and feel like a standalone app. The app runs in its own window, separate from the browser, and hides standard browser UI elements like the URL bar.|
|This mode is similar to |
|A standard browser experience.|
These display modes follow a well-defined fallback chain (
"browser"). If a browser does not support a given mode, it falls back to the next display mode in the chain.
Shortcomings of the
The problem with this hard-wired fallback chain approach is threefold:
- A developer cannot request
"minimal-ui"without being forced back into the
"browser"display mode in case
"minimal-ui"is not supported by a given browser.
- Developers have no way of handling cross-browser differences, like if the browser includes or excludes a back button in the window for
- The current behavior makes it impossible to introduce new display modes in a backward compatible way, since explorations like tabbed application mode do not have a natural place in the fallback chain.
These problems are solved by the
display_override property, which the browser considers before the
display property. Its value is a sequence of strings that are considered in-order, and the first supported display mode is applied. If none are supported, the browser falls back to evaluating the
display_override property is meant to solve special corner cases. In almost all circumstances the regular
display property is what developers should reach for.
In the example below, the display mode fallback chain would be as follows. (The details of
"window-controls-overlay" are out-of-scope for this article.)
"window-controls-overlay"(First, look at
display_overrideis exhausted, evaluate
"minimal-ui"(Finally, use the
"display_override": ["window-controls-overlay", "minimal-ui"],
The browser will not consider
display is also present.
To remain backward compatible, any future display mode will only be acceptable as a value of
display_override, but not
display. Browsers that do not support
display_override fall back to the
display property and ignore
display_override as an unknown Web App Manifest property.
display_override property is defined independently from its potential values.
display_override property is supported as of Chromium 89. Other browsers support the
display property, which caters to the majority of display mode use cases.
display_override property was formalized by Daniel Murphy.