This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The ongamepadconnected
property of the Window
interface represents an event handler that will run when a gamepad is connected (when the gamepadconnected
event fires).
The event object is of type GamepadEvent
.
Syntax
window.ongamepadconnected = function() { ... };
Examples
window.ongamepadconnected = function(event) {
// All buttons and axes values can be accessed through
event.gamepad;
};
Specifications
Specification | Status | Comment |
---|---|---|
Unknown The definition of 'gamepadconnected event' in that specification. |
Working Draft | Initial definition |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
General support | 21.0 webkit 35.0 |
(Yes) | 29.0 (29.0) | No support | 15.0 webkit 22.0 |
10.1 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Samsung Internet |
---|---|---|---|---|---|---|---|
General support | No support | (Yes) | 32.0 (32.0) | No support | No support | No support | Yes |
See also
- The Gamepad API by Ted Mielczarek and Robert Nyman
- Simple API demo page (source)
Document Tags and Contributors
Tags:
Contributors to this page:
chrisdavidmills
Last updated by:
chrisdavidmills,