This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
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 |
GamepadThe definition of 'gamepadconnected event' in that specification. | Working Draft | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ongamepadconnected
|
Chrome Full support 35 Full support 35 No support 21 — 35 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support ≤18 |
Firefox
Full support 29 |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 22 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
Full support 37 |
Chrome Android Full support 35 Full support 35 No support 25 — 35 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 22 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
No support No |
Samsung Internet Android Full support 3.0 Full support 3.0 No support 1.5 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
Legend
- Full support
- Full support
- No support
- No support
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
See also
- The Gamepad API by Ted Mielczarek and Robert Nyman
- Simple API demo page (source)
Window.ongamepadconnected by Mozilla Contributors is licensed under CC-BY-SA 2.5.