Window: gamepadconnected event

The gamepadconnected event is fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.

Bubbles No
Cancelable No
Interface GamepadEvent
Event handler property ongamepadconnected

The event will not fire if disallowed by the document's gamepad Feature Policy.

Examples

window.addEventListener('gamepadconnected', event => {

    // All buttons and axes values can be accessed through
    event.gamepad;

});

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
gamepadconnected_event
35
21-35
≤18
29
No
22
15-22
10.1
37
37
32
Yes
No
3.0

See also

© 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/Window/gamepadconnected_event