Back to Content

WindowControlsOverlay

files/en-us/web/api/windowcontrolsoverlay/index.md

latest1.5 KB
Original Source

{{APIRef("Window Controls Overlay API")}}{{securecontext_header}}{{SeeCompatTable}}

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 {{domxref('Navigator.windowControlsOverlay')}}.

{{InheritanceDiagram}}

Instance properties

  • {{domxref("WindowControlsOverlay.visible")}} {{ReadOnlyInline}} {{Experimental_Inline}}
    • : A {{Glossary("Boolean")}} that indicates whether the window controls overlay is visible or not.

Instance methods

  • {{domxref("WindowControlsOverlay.getTitlebarAreaRect()")}} {{Experimental_Inline}}
    • : Returns the size and position of the title bar.

Events

Listen to these events using {{domxref('EventTarget.addEventListener()')}} or by assigning an event listener to the relevant oneventname property of this interface.

  • {{domxref("WindowControlsOverlay/geometrychange_event", "geometrychange")}} {{Experimental_Inline}}
    • : Fired when the geometry of the title bar area changes.

Examples

js
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

{{Specifications}}

Browser compatibility

{{Compat}}