Window Controls Overlay API
The WindowControlsOverlay interface of the Window Controls Overlay API exposes information about the geometry
of the title bar area in desktop Progressive Web Apps, and an event to know whenever it changes. This interface is accessible from Navigator.windowControlsOverlay.
Instance properties
- WindowControlsOverlay.visible
- : A Boolean that indicates whether the window controls overlay is visible or not.
Instance methods
- WindowControlsOverlay.getTitlebarAreaRect()
- : Returns the size and position of the title bar.
Events
Listen to these events using EventTarget.addEventListener() or by assigning an event listener to the relevant oneventname property of this interface.
- WindowControlsOverlay/geometrychange_event
- : Fired when the geometry of the title bar area changes.
Examples
if ("windowControlsOverlay" in navigator) {
navigator.windowControlsOverlay.addEventListener(
"geometrychange",
(event) => {
if (event.visible) {
const rect = event.titlebarAreaRect;
// Do something with the coordinates of the title bar area.
}
},
);
}
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
