Gamepad API

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.

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 of Gamepad 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

Specifications

Specification Status Comment
Gamepad Extensions Editor's Draft Defines the Experimental Gamepad extensions.
Gamepad
The definition of 'The Gamepad API specification' in that specification.
Working Draft Initial definition

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
GamepadChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support ≤18Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Gamepad() constructorChrome Full support 35Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22Safari Full support 10.1WebView Android No support NoChrome Android Full support 35Firefox Android Full support 32Opera Android Full support 22Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
axesChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
buttonsChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
connectedChrome Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
hand
Experimental
Chrome No support NoEdge No support 15 — 79Firefox Full support Yes
Notes Disabled
Full support Yes
Notes Disabled
Notes The flag is enabled by default in Firefox Nightly and Beta, versions 55 and above.
Disabled This feature is behind the dom.gamepad-extensions.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
hapticActuators
Experimental
Chrome No support NoEdge No support 15 — 79Firefox Full support Yes
Notes Disabled
Full support Yes
Notes Disabled
Notes The flag is enabled by default in Firefox Nightly and Beta, versions 55 and above.
Disabled This feature is behind the dom.gamepad-extensions.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
id
Experimental
Chrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari No support NoWebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
index
Experimental
Chrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
mappingChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
timestampChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 12Firefox Full support 29
Full support 29
No support 24 — 28
Disabled
Disabled From version 24 until version 28 (exclusive): this feature is behind the dom.gamepad.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari Full support 10.1WebView Android No support NoChrome Android Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support 32Opera Android Full support 22
Full support 22
No support 14 — 21
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Safari iOS Full support 10.3Samsung Internet Android Full support 4.0
Full support 4.0
No support 2.0 — 3.0
Prefixed
Prefixed Implemented with the vendor prefix: webkit
vibrationActuator
ExperimentalNon-standard
Chrome Full support 68Edge Full support 79Firefox No support NoIE No support NoOpera Full support 55Safari No support NoWebView Android No support NoChrome Android Full support 68Firefox Android No support NoOpera Android Full support 48Safari iOS No support NoSamsung 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