browsersays

navigator.getGamepads

Connected controllers can be enumerated with their make and model, and this one is in every browser. Why the list is empty until you press something.

Checking the browser you are reading this in…

Entry in question 5: What it can plug into

What it is

Returns the list of game controllers the browser currently knows about, each with its axes, its buttons and an identifier string naming the make and model.

What a site can do with it

The identifier strings are the part worth knowing about: they are detailed, they vary between controllers, and a set of them is an unusual combination. The mitigation is that the list stays empty until you actually interact with a controller — so a page cannot enumerate your hardware just by being open. Unlike the rest of this section it needs no permission prompt, because that interaction is the permission.

Check it yourself

Open your browser's developer tools, go to the console, and paste this. Nothing is sent anywhere; the answer comes from the browser you are reading this in.

navigator.getGamepads().length

The full path recorded by the walk is navigator.getGamepads, and that is the string the leaflet prints beside this entry.

What the answer is on an ordinary browser

Written by hand for each of the three engines, because a table generated from one sentence would be worth nothing to the person reading it.

Chrome
Present. The list is empty until a button or axis is used.
Firefox
Present, with the same behaviour.
Safari
Present, with the same behaviour.

If your browser is not present, the leaflet prints this instead of dimming the line: Not present. This is unusual: the interface has been in every major browser for years.

Where it sits in the leaflet

This is one of 6 entries in question 5, what it can plug into. The leaflet reads all 42 entries in one press and prints each answer beside the question, with the property name next to it so you can check any line.

Read my browser · navigator.bluetooth · navigator.webdriver