Window: gamepaddisconnected event
Baseline 2025Newly available
Since December 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Thegamepaddisconnected event is fired when the browser detects that a gamepad has been disconnected.
The event will not fire if disallowed by the document'sgamepadPermissions Policy.
This event is not cancelable and does not bubble.
In this article
Syntax
Use the event name in methods likeaddEventListener(), or set an event handler property.
js
addEventListener("gamepaddisconnected", (event) => { })ongamepaddisconnected = (event) => { }Examples
To be informed when a gamepad is disconnected, you can add a handler to the window usingaddEventListener(), like this:
js
window.addEventListener("gamepaddisconnected", (event) => { console.log("Lost connection with the gamepad.");});Alternatively, you can use thewindow.ongamepaddisconnected event handler property to establish a handler for thegamepaddisconnected event:
js
window.ongamepaddisconnected = (event) => { console.log("Lost connection with the gamepad.");};Specifications
| Specification |
|---|
| Gamepad> # event-gamepaddisconnected> |