The Gamepad API is a way for developers to access and respond to signals from gamepads and other game controllers in a simple, consistent way. It contains three interfaces, two events and one specialist function, to respond to gamepads being connected and disconnected, and to access other information about the gamepads themselves, and what buttons and other controls are currently being pressed.
Interfaces
Gamepad
- Represents a gamepad/controller connected to the computer.
GamepadButton
- Represents a button on one of the connected controllers.
GamepadEvent
- The event object representing events fired that are related to gamepads.
Experimental Gamepad extensions
GamepadHapticActuator
- Represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.
GamepadPose
- Represents the pose of a controller (e.g. position and orientation in 3D space) in the case of a WebVR controller. This is not used by the newer WebXR standard.
See also the extensions to the Gamepad interface, for features that allow you to access the above information.
Extensions to other interfaces
Navigator.getGamepads()
- An extension to the
Navigator
object that returns an array ofGamepad
objects, one for each connected gamepad.
Window events
Window.ongamepadconnected
- Represents an event handler that will run when a gamepad is connected (when the
gamepadconnected
event fires). Window.ongamepaddisconnected
- Represents an event handler that will run when a gamepad is disconnected (when the
gamepaddisconnected
event fires).
Tutorials and guides
- Using the Gamepad API
- [[../../../Games/Techniques/Controls_Gamepad_API|Implementing controls using the Gamepad API]]
Specifications
Specification | Status | Comment |
Gamepad Extensions | Editor's Draft | Defines the Experimental Gamepad extensions. |
GamepadThe definition of 'The Gamepad API specification' 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Gamepad
|
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
axes
|
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
buttons
|
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
connected
|
Chrome Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
Chrome No support ? — 80 No support ? — 80 Notes' Only works on desktop in an experimental version of Chrome (other builds won't return any devices when |
Edge
Full support 15 |
Firefox Full support 55 Full support 55 Notes' Windows support was enabled in Firefox 55. Full support 64 Notes' macOS support was enabled in Firefox 64. |
IE
No support No |
Opera
? |
Safari
No support No |
WebView Android
No support No |
Chrome Android No support ? — 80 No support ? — 80 Notes' Currently supported only by Google Daydream. |
Firefox Android
Full support 55 |
Opera Android
? |
Safari iOS
No support No |
Samsung Internet Android No support ? — 13.0 No support ? — 13.0 Notes' Currently supported only by Google Daydream. | |
Chrome
No support No |
Edge
No support 15 — 79 |
Firefox Full support Yes Full support Yes Notes' The flag is enabled by default in Firefox Nightly and Beta, versions 55 and above.
Disabled' This feature is behind the |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
No support No |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
No support No | |
Chrome
No support No |
Edge
No support 15 — 79 |
Firefox Full support Yes Full support Yes Notes' The flag is enabled by default in Firefox Nightly and Beta, versions 55 and above.
Disabled' This feature is behind the |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
No support No |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
No support No | |
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
No support No |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
No support No |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit | |
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit | |
mapping
|
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
Chrome
No support No |
Edge
No support 15 — 79 |
Firefox Full support Yes Full support Yes Notes' The flag is enabled by default in Firefox Nightly and Beta, versions 55 and above.
Disabled' This feature is behind the |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
No support No |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
No support No | |
timestamp
|
Chrome Full support 35 Full support 35 No support 21 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Edge
Full support 12 |
Firefox Full support 29 Full support 29 No support 24 — 28 Disabled' From version 24 until version 28 (exclusive): this feature is behind the |
IE
No support No |
Opera Full support 22 Full support 22 No support 15 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari
Full support 10.1 |
WebView Android
No support No |
Chrome Android Full support 35 Full support 35 No support 25 — 34 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 32 |
Opera Android Full support 22 Full support 22 No support 14 — 21 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS
Full support 10.3 |
Samsung Internet Android Full support 4.0 Full support 4.0 No support 2.0 — 3.0 Prefixed' Implemented with the vendor prefix: webkit |
|
Chrome
Full support 68 |
Edge
Full support 79 |
Firefox
No support No |
IE
No support No |
Opera
Full support 55 |
Safari
No support No |
WebView Android
No support No |
Chrome Android
Full support 68 |
Firefox Android
No support No |
Opera Android
Full support 48 |
Safari iOS
No support No |
Samsung Internet Android
Full support 10.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.'
- Deprecated. Not for use in new websites.
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
- 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)
Gamepad API by Mozilla Contributors is licensed under CC-BY-SA 2.5.