This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
The disconnect() method of the ResizeObserver interface unobserves all observed Element or SVGElement targets.
disconnect()
None.
None (undefined).
None.
btn.addEventListener("click", () => {
resizeObserver.disconnect();
});
| Specification |
|---|
| Resize Observer> # dom-resizeobserver-disconnect> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
disconnect |
64 | 79 | 69 | 51 | 13.1 | 64 | 79 | 47 | 13.4 | 9.0 | 64 | 13.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/disconnect