The geometrychange
event is fired when the position, size, or visibility of a Progressive Web App's title bar area changes.
This only applies to Progressive Web Apps installed on desktop operating systems and use the Window Controls Overlay API.
The geometrychange
event is fired when the position, size, or visibility of a Progressive Web App's title bar area changes.
This only applies to Progressive Web Apps installed on desktop operating systems and use the Window Controls Overlay API.
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener('geometrychange', event => { }) ongeometrychange = event => { }
A WindowControlsOverlayGeometryChangeEvent
. Inherits from Event
.
In addition to the properties listed below, properties from the parent interface, Event
, are available.
Using addEventListener()
:
navigator.windowControlsOverlay.addEventListener('geometrychange', (event) => { const {x, y, width, height} = event.titlebarAreaRect; console.log(`The titlebar area coordinates are x:${x}, y:${y}, width:${width}, height:${height}`); });
Using the ongeometrychange
event handler property:
navigator.windowControlsOverlay.ongeometrychange = (event) => { const {x, y, width, height} = event.titlebarAreaRect; console.log(`The titlebar area coordinates are x:${x}, y:${y}, width:${width}, height:${height}`); };
Specification |
---|
Window Controls Overlay # the-ongeometrychange-attribute |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
geometrychange_event |
98
|
98
|
No
|
No
|
84
|
No
|
No
|
No
|
No
|
No
|
No
|
No
|
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/geometrychange_event