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 WebVRcontroller.

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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support YesFirefox 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes
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 No support NoWebView Android No support NoChrome Android Full support 35Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22Safari iOS No support NoSamsung Internet Android Full support Yes
axesChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes
buttonsChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes
connectedChrome Full support 35
Full support 35
No support 25 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes
displayId
Experimental
Chrome Full support Yes
Notes Disabled
Full support Yes
Notes Disabled
Notes Only works on desktop in an experimental version of Chrome (other builds won't return any devices when Navigator.getVRDisplays() is invoked).
Disabled This feature is behind the WebVR preference. To change preferences in Chrome, visit chrome://flags.
Edge Full support 15Firefox Full support 56
Notes
Full support 56
Notes
Notes Currently only Windows support is enabled by default. Mac support is available in Firefox Nightly.
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android Full support Yes
Notes
Full support Yes
Notes
Notes Currently supported only by Google Daydream.
Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
hand
Experimental
Chrome No support NoEdge Full support 15Firefox 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 NoEdge Mobile 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 Full support 15Firefox 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 NoEdge Mobile 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 Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android No support NoSafari iOS No support NoSamsung Internet Android Full support Yes
index
Experimental
Chrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android No support NoSafari iOS No support NoSamsung Internet Android Full support Yes
mappingChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes
pose
Experimental
Chrome No support NoEdge Full support 15Firefox 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 NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
timestampChrome Full support 35
Full support 35
No support 21 — 34
Prefixed
Prefixed Requires 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 Requires 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 Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 32Opera Android Full support 22
Full support 22
No support 15 — 21
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS No support NoSamsung Internet Android Full support Yes

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.
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

Document Tags and Contributors

Last updated by: TheTophatDemon,