← Device Access
Gamepad
Probing…Gamepad is a web platform capability in the Device Access category. Read connected game controllers: buttons, axes, rumble. Supported in Chromium 21+, Firefox 29+, and Safari 10.1+. Requires a user gesture such as a click or tap.
User gesture
Try it
Loading demo…
Code
window.addEventListener('gamepadconnected', (e) => {
console.log('connected', e.gamepad.id)
})
function poll() {
for (const gp of navigator.getGamepads()) {
if (!gp) continue
const pressed = gp.buttons.filter(b => b.pressed).length
console.log(gp.index, 'buttons pressed:', pressed, 'axes:', gp.axes)
}
requestAnimationFrame(poll)
}
poll()Browser support
Chromium
21
Firefox
29
Safari
10.1
Frequently asked questions
Which browsers support Gamepad?
Supported in Chromium 21+, Firefox 29+, and Safari 10.1+.
Does Gamepad require HTTPS?
No. Gamepad works without a secure context, though serving your site over HTTPS is always recommended.
What is Gamepad used for?
Read connected game controllers: buttons, axes, rumble.
Can I try Gamepad in my browser?
Yes. shwcs.net runs a live Gamepad demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.