Gamepad presence
Lists connected game controllers, but only after a button press on the controller.
In one line
Can see a game controller only after you press a button on it
Lists connected game controllers, but only after a button press on the controller.
Reveals a controller is plugged in or paired (id string includes vendor and product IDs). Hidden until the user presses a button, so it is not a silent probe.
What it can and can't do
What the user does: You press a button on a connected controller while the page is open
It can
- List connected controllers, including maker and product codes
- Use the controller to play a game in the page
- Tell when a controller connects or disconnects
It cannot
- See a controller before you press a button on it
- See controllers when the tab is in the background
- Learn anything about other devices
- Silently check; pressing a button is required
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 35 | 2014-05-20 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 29 | 2014-04-29 | None |
| Safari | Supported | 10.1 | 2017-03-27 | None |
| Safari on iPhone | Supported | 10.3 | 2017-03-27 | None |
| Chrome on Android | Supported | 35 | 2014-05-20 | None |
| Samsung Internet | Supported | 3.0 | 2015-04-10 | None |
How a site asks for it
| API | navigator.getGamepads(), gamepadconnected event |
| Permissions policy | gamepad |
| Browser compat keys | api.Navigator.getGamepads |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | read fresh on every page load; nothing stored |
| How to take it back | none needed (no grant) |
| Inside an iframe | Readable from cross-origin iframes too (same values) |
Typical flow
- Page script reads the value
- No prompt is shown
Data you get
Shape: object
How often: static per session
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
id | string | None | e.g. Xbox 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e) | Not listed |
buttons | list | None | up to 17 buttons | Not listed |
axes | list | None | up to 4 axes, -1 to 1 | Not listed |
Technical limits
- Needs user input on the pad first
- Only while the page is focused
The story
What it is
Lists game controllers connected to your device, but only after you press a button on one.
For you
You plug in or pair a controller, then press a button. Only then the page can see it. Nothing shows up before that, so it is not a silent check.
For makers
Games and cloud gaming sites want controller support to feel like a console. The press-a-button rule stops sites from quietly listing devices. The controller name still shows the brand, which is a small fingerprint clue.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A cloud gaming site such as Xbox Cloud Gaming shows controller buttons on screen after you press a button on your Xbox pad. | Xbox Cloud Gaming, GeForce NOW |
| games | A browser platformer or racing game switches from keyboard hints to PlayStation button icons when it sees a DualSense. | Poki |
| games | A multiplayer party game in the browser assigns player 1 to 4 as each friend presses a button on their pad. | None named |
| accessibility | A web game supports an adaptive controller so players with limited mobility can join in. | None named |
| media | A browser media center app lets you browse shows with a gamepad on a living room TV. | None named |
| education | A web robotics simulator lets students drive a virtual robot with a joystick. | None named |
| security | A fingerprinting script records the controller ID string once a user presses a button. | None named |
Risks
- Brand and model of controller revealed
- Only after a button press
What the platform says
- MDN: Gamepad API. Documents how pages read controllers so web games can feel like console games.
Good uses and abuse
Legitimate uses
- Browser games
Known abuse
- Detect gamers
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 1 | Rough identifying entropy, when known |
History
- 2018-01, Chrome: Secure context and focused-page needed; Permissions-Policy gamepad added
Sources
How well checked: Based on official documentation.