docs.rodeo

MDN Web Docs mirror

display

{{QuickLinksWithSubpages("/en-US/docs/Web/Progressive_web_apps/Manifest/Reference")}} 

The display manifest member is used to specify your preferred display mode for the web application. The display mode determines how much of the browser UI is shown to the user when the app is launched within the context of an operating system. You can choose to show the full browser interface or hide it to provide a more app-like experience.

Syntax

/* Keyword values */
"display": "fullscreen"
"display": "standalone"
"display": "minimal-ui"
"display": "browser"

Values

Description

After a browser applies a display mode to an {{Glossary("application context")}} , it becomes the default display mode for the top-level browsing context. The browser may override this display mode for security reasons or provide users with a means for switching to another display mode.

If a browser does not support the specified display mode, it follows a pre-defined fallback chain: fullscreenstandaloneminimal-uibrowser.

The {{cssxref("@media/display-mode", "display-mode")}}  media feature can be used to configure your application styles and other behavior based on the current display mode. This can help provide a consistent user experience regardless of whether the website is launched from a URL or from a desktop icon.

[!NOTE] The value of the display-mode media feature reflects the actual display mode being used by the browser. This might differ from the mode requested in the manifest, because the browser might not support the requested mode.

As shown in the code below, you can adjust an app’s style depending on the display-mode used.

@media (display-mode: standalone) {
  body {
    background-color: #f0f0f0; /* Light grey background for standalone mode */
  }
}

@media (display-mode: fullscreen) {
  body {
    background-color: #000000; /* Black background for fullscreen mode */
  }
}

Examples

Specifying standalone display mode

The following example manifest file for the web app named “HackerWeb” defines how the app should appear and behave when installed on a user’s device. The display member is set to standalone, which specifies that the app should open in a separate window without the typical browser UI elements like the URL bar.

{
  "name": "HackerWeb",
  "short_name": "HackerWeb",
  "start_url": "/index.html",
  "display": "standalone",
  "background_color": "#ffffff",
  "description": "A readable Hacker News app",
  "icons": [
    {
      "src": "images/icons/homescreen192.png",
      "sizes": "192x192",
      "type": "image/png"
    }
  ]
}

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

In this article

View on MDN