大网数据广告活动
Web 标准与前端开发

Window Controls Overlay API

· 52CE 我爱测

The Window Controls Overlay API gives Progressive Web Apps installed on desktop operating systems the ability to hide the default window title bar and display their own content over the full surface area of the app window, turning the control buttons (maximize, minimize, and clos

Window Controls Overlay API

The Window Controls Overlay API gives Progressive Web Apps installed on desktop operating systems the ability to hide the default window title bar and display their own content over the full surface area of the app window, turning the control buttons (maximize, minimize, and close) into an overlay.

Opting-in to the feature

Before using this feature, the following conditions must be true:

  • The Web App Manifest's display_override member must be set to window-controls-overlay.
  • The Progressive Web App must be installed on a desktop operating system.

Main concepts

Progressive Web Apps installed on desktop devices can be displayed in standalone app windows, just like native apps. Here is what an application window looks like:

Illustration of a PWA installed on desktop, with window control buttons, a title bar, and web content below that

As seen above, the app window is made of two main areas:

  • The title bar area at the top.
  • The application content area at the bottom, which displays the HTML content from the PWA.

The title bar area contains the system-critical maximize, minimize, and close buttons (their position may vary across operating systems), the name of the application (which comes from the <title> HTML element in the page), and possibly user-agent-specific PWA buttons.

With the Window Controls Overlay feature, Progressive Web Apps can display their web content over the whole app window surface area. Because the window control buttons and user-agent-specific PWA buttons must remain visible, they get turned into an overlay displayed on top of the web content.

Illustration of a PWA installed on desktop with the Window Controls Overlay feature, with window control buttons, no title bar, and web content spanning the whole window

The part of the title bar that normally contains the application name is hidden, and the area that it normally occupies becomes available via the Window Controls Overlay API.

PWAs can use the API to position content in this area, and avoid having content hidden behind the control buttons overlay, similar to how web authors can account for the presence of notches on certain mobile devices.

CSS environment variables

Progressive Web Apps can position their web content in the area that the title bar normally occupies by using the titlebar-area-x, titlebar-area-y, titlebar-area-width, and titlebar-area-height CSS environment variables. See Using env() to ensure content is not obscured by window control buttons in desktop PWAs.

Interfaces

  • WindowControlsOverlay
    • : Provides information about the visibility and geometry of the title bar and an event to know whenever it changes.
  • WindowControlsOverlayGeometryChangeEvent
    • : Represents events providing information related to the desktop Progress Web App's title var region when its size or visibility changes.

Extensions to other interfaces

  • Navigator.windowControlsOverlay
    • : Returns the WindowControlsOverlay interface, which exposes information about the title bar geometry in desktop Progressive Web Apps.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。