JavaScript Navigator windowControlsOverlay Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Experimental

What You’ll Learn

navigator.windowControlsOverlay is the experimental entry point to the Window Controls Overlay API for desktop Progressive Web Apps. Learn visible, getTitlebarAreaRect(), geometrychange, the manifest opt-in, five examples, and try-it labs.

01

Kind

Read-only property

02

Returns

WindowControlsOverlay

03

Status

Experimental

04

Context

Secure (HTTPS)

05

Target

Desktop PWAs

06

Key method

getTitlebarAreaRect()

Introduction

Installed desktop apps usually have a title bar with minimize / maximize / close buttons. Progressive Web Apps can look more “native” by drawing their own UI in that space — logo, tabs, search — while the OS still owns the window buttons.

That feature is the Window Controls Overlay. After you opt in from the web app manifest, navigator.windowControlsOverlay tells your page the geometry of the free title bar area so your custom chrome does not collide with the system controls.

💡
Manifest opt-in

MDN: use the window-controls-overlay value in display_override. That hides the default title bar and gives the app access to the full window area.

Understanding the windowControlsOverlay Property

The property itself is only the entry point. The useful pieces live on the returned WindowControlsOverlay object.

  • visible — boolean: is the window controls overlay visible?
  • getTitlebarAreaRect() — returns a DOMRect for the title bar region.
  • geometrychange — event when the title bar geometry (or visibility) changes.
  • Secure context — HTTPS / localhost required.
  • Desktop PWA focus — most useful after install + manifest opt-in.
  • Limited support — feature-detect; keep a fallback layout.

📝 Syntax

General form of the property:

JavaScript
navigator.windowControlsOverlay

Value

  • A WindowControlsOverlay object (when supported).

Common patterns

JavaScript
// MDN-style feature detect + title bar rect
if ("windowControlsOverlay" in navigator) {
  const rect = navigator.windowControlsOverlay.getTitlebarAreaRect();
  // Do something with the title bar area rectangle.
} else {
  // The Window Controls Overlay feature is not available.
}

// Listen for geometry changes (MDN):
if ("windowControlsOverlay" in navigator) {
  navigator.windowControlsOverlay.addEventListener("geometrychange", (event) => {
    if (event.visible) {
      const rect = event.titlebarAreaRect;
      // Layout custom title bar UI using rect
    }
  });
}

Manifest sketch (for installed desktop PWAs)

JavaScript
{
  "name": "My Desktop PWA",
  "display": "standalone",
  "display_override": ["window-controls-overlay"]
}

⚡ Quick Reference

GoalCode
Get overlay APInavigator.windowControlsOverlay
Feature detect"windowControlsOverlay" in navigator
Is overlay visible?navigator.windowControlsOverlay.visible
Title bar rectanglegetTitlebarAreaRect()
Listen for changesaddEventListener("geometrychange", …)
Secure context?window.isSecureContext
Manifest opt-indisplay_override: ["window-controls-overlay"]

🔍 At a Glance

Four facts to remember about navigator.windowControlsOverlay.

Returns
WindowControlsOverlay

Title bar API

Status
Experimental

Not Baseline

Context
HTTPS

Secure required

Best in
Desktop PWA

Installed + opt-in

📋 Default Title Bar vs Window Controls Overlay

Default desktop windowWith Window Controls Overlay
Title barOS / browser draws itHidden; app can draw custom UI
Window buttonsIn the system title barStill OS-owned; overlay leaves a safe region
How to enableNothing specialManifest display_override + install
JS helperN/Anavigator.windowControlsOverlay

Examples Gallery

Examples follow MDN navigator.windowControlsOverlay patterns. Prefer Try It Yourself — in a normal browser tab the API is often missing or visible is false until you run an installed desktop PWA with the overlay enabled.

📚 Getting Started

Detect the API and check whether the overlay is visible.

Example 1 — Feature Detection

MDN-style support check before using title bar geometry.

JavaScript
const lines = [
  "windowControlsOverlay: " +
    ("windowControlsOverlay" in navigator ? "available" : "missing"),
  "isSecureContext: " + window.isSecureContext
];
console.log(lines.join("\n"));
Try It Yourself

How It Works

Missing is normal in a regular tab. Keep a fallback header layout for that case.

Example 2 — Read visible

Check whether the window controls overlay is currently visible.

JavaScript
if (!("windowControlsOverlay" in navigator)) {
  console.log("windowControlsOverlay not supported");
} else {
  console.log("visible: " + navigator.windowControlsOverlay.visible);
}
Try It Yourself

How It Works

Only draw a custom title bar when visible is true.

📈 Practical Patterns

Measure the title bar area, listen for changes, and apply a simple layout.

Example 3 — getTitlebarAreaRect()

MDN’s basic example: read the title bar rectangle.

JavaScript
if (!("windowControlsOverlay" in navigator)) {
  console.log("windowControlsOverlay not supported");
} else {
  const rect = navigator.windowControlsOverlay.getTitlebarAreaRect();
  console.log(
    "x=" + rect.x +
    " y=" + rect.y +
    " w=" + rect.width +
    " h=" + rect.height
  );
}
Try It Yourself

How It Works

Use the rectangle to position a custom toolbar that leaves room for the OS window buttons.

Example 4 — geometrychange Listener

MDN pattern: update layout when the title bar geometry changes.

JavaScript
if (!("windowControlsOverlay" in navigator)) {
  console.log("windowControlsOverlay not supported");
} else {
  navigator.windowControlsOverlay.addEventListener("geometrychange", (event) => {
    if (event.visible) {
      const rect = event.titlebarAreaRect;
      console.log("geometrychange:", {
        x: rect.x,
        y: rect.y,
        width: rect.width,
        height: rect.height
      });
    } else {
      console.log("Overlay not visible — use fallback chrome");
    }
  });
  console.log("Listening for geometrychange");
}
Try It Yourself

How It Works

Window resize and display changes can move the safe title bar region — listen and re-layout.

Example 5 — Apply Title Bar Padding

Beginner layout helper: set CSS variables from the title bar rect when visible.

JavaScript
function applyTitlebarLayout() {
  if (!("windowControlsOverlay" in navigator)) {
    return "API missing — keep a normal header";
  }
  const wco = navigator.windowControlsOverlay;
  if (!wco.visible) {
    return "Overlay not visible — keep a normal header";
  }
  const rect = wco.getTitlebarAreaRect();
  document.documentElement.style.setProperty("--titlebar-x", rect.x + "px");
  document.documentElement.style.setProperty("--titlebar-w", rect.width + "px");
  document.documentElement.style.setProperty("--titlebar-h", rect.height + "px");
  return "CSS vars set from title bar rect";
}

console.log(applyTitlebarLayout());
Try It Yourself

How It Works

Pair this with CSS that positions a custom title bar using the variables — and hide that bar when the API or overlay is unavailable.

🚀 Common Use Cases

  • Custom PWA title bars — brand, tabs, or search in the title region.
  • Desktop-first PWAs — make installed apps feel closer to native shells.
  • Responsive chrome — reflow title UI on geometrychange.
  • Safe insets — avoid drawing under minimize / maximize / close.
  • Progressive enhancement — fall back to a normal in-page header.

🧠 How navigator.windowControlsOverlay Works

1

Opt in from the manifest

Set display_override to include window-controls-overlay.

Manifest
2

Install the desktop PWA

The default title bar can hide; the app gets the full window area.

Install
3

Read geometry in JS

Use visible, getTitlebarAreaRect(), and geometrychange.

Measure
4

Draw custom chrome safely

Place UI in the free title bar region; keep a fallback without the API.

📝 Notes

  • Experimental & Limited availability — not Baseline; feature-detect always.
  • Not Deprecated or Non-standard — Experimental banner only.
  • Secure context required (HTTPS / localhost).
  • Returns WindowControlsOverlay; main pieces are visible, getTitlebarAreaRect(), geometrychange.
  • Related: webdriver, xr, wakeLock, Window.

Limited / Experimental Support

navigator.windowControlsOverlay belongs to the experimental Window Controls Overlay API and is not Baseline. It targets installed desktop PWAs with a manifest opt-in. Always feature-detect, use HTTPS, and keep a normal header fallback.

Experimental · Not Baseline

Navigator.windowControlsOverlay

WindowControlsOverlay entry point — title bar geometry for desktop PWAs that hide the default title bar.

Limited Experimental
Google Chrome Desktop PWA / Chromium Window Controls Overlay
Limited
Microsoft Edge Desktop PWA / follow Chromium support
Limited
Opera Follow Chromium desktop PWA support
Limited
Mozilla Firefox Typically unavailable — feature-detect
Unavailable
Apple Safari Typically unavailable — feature-detect
Unavailable
Internet Explorer No windowControlsOverlay support
Unavailable
windowControlsOverlay Limited

Bottom line: Detect navigator.windowControlsOverlay, opt in with display_override, measure getTitlebarAreaRect when visible, and never require the API for core navigation chrome.

Conclusion

navigator.windowControlsOverlay is the experimental entry point for desktop PWA title bar geometry. Opt in from the manifest, measure the free title bar area, listen for geometrychange, and keep a solid fallback when the API is missing.

Continue with xr, webdriver, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect "windowControlsOverlay" in navigator
  • Opt in with display_override in the manifest
  • Use HTTPS / localhost
  • Layout only when visible is true
  • Listen for geometrychange on resize

❌ Don’t

  • Assume Baseline support in every browser
  • Require the API for core navigation
  • Draw under the OS window buttons
  • Ignore secure-context requirements
  • Assign to navigator.windowControlsOverlay

Key Takeaways

Knowledge Unlocked

Five things to remember about windowControlsOverlay

Experimental desktop PWA title bar geometry — detect, measure, fall back.

5
Core concepts
02

Status

Experimental

Limited
🔒 03

Context

secure HTTPS

Required
🖥 04

Measure

getTitlebarAreaRect

Geometry
🎯 05

Opt in

display_override

Manifest

❓ Frequently Asked Questions

A WindowControlsOverlay object. In desktop Progressive Web Apps that opt into Window Controls Overlay, it exposes title bar geometry (getTitlebarAreaRect), a visible flag, and a geometrychange event.
MDN marks the WindowControlsOverlay interface Experimental and Limited availability (not Baseline). It is not Deprecated or Non-standard. Always feature-detect and keep a fallback title bar layout.
Yes. MDN lists it as a secure-context feature (HTTPS or localhost) in supporting browsers.
In your web app manifest, use display_override with the value window-controls-overlay (and install the PWA on desktop). That hides the default title bar and gives the app the full window area.
A method that returns a DOMRect describing the size and position of the title bar area so you can place custom UI (logo, tabs, search) without covering the window controls.
Usually the API is missing or the overlay is not visible outside an installed desktop PWA with the manifest opt-in. Always feature-detect and design a fallback.
Did you know?

Window Controls Overlay does not remove the minimize / maximize / close buttons. It hides the default title bar chrome and tells your page where the safe title bar rectangle is so your custom UI can sit beside those OS controls.

Explore xr Next

Start immersive VR/AR experiences with the WebXR Device API.

xr →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful