WebHID
Lets a site read and write raw reports from a keyboard, pad or other HID device the person picks.
In one line
Can talk to one keyboard, pad or other device you pick from a list
Lets a site read and write raw reports from a keyboard, pad or other HID device the person picks.
Gives full access to exotic input hardware (Stream Decks, game controllers, 3D mice, medical devices) beyond what the OS exposes. The device list and report data can identify the hardware and its state.
What it can and can't do
What the user does: You tap Connect device and pick one from the chooser.
It can
- Show devices that match what the site asks for
- Get the buttons, keys and sensor data of the one you pick
- Send commands such as lights or settings to it
It cannot
- Use devices you did not pick
- Work with your normal keyboard and mouse, which browsers keep blocked
- Work in Firefox, Safari or on phones
- Keep access after you remove the permission
How it differs between platforms: Only desktop Chrome and Edge support it. Firefox, Safari and phone browsers do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 89 | 2021-03-02 | None |
| Edge | Supported | 89 | 2021-03-04 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Not supported | Not available | Not listed | No WebHID on Android |
| Samsung Internet | Not supported | Not available | Not listed | No WebHID on Android |
How a site asks for it
| API | navigator.hid.requestDevice({filters}), getDevices(), device.open(), sendReport(), oninputreport |
| Permission name | hid |
| Permissions policy | hid |
| Browser compat keys | api.HIDapi.HIDDeviceapi.Navigator.hid |
| How access is granted | picker |
| What the user sees | Chooser listing HID devices that match filters |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | Yes |
| How long it lasts | Per origin and device; getDevices() returns granted devices |
| How to take it back | Site settings, chooser, device.forget() (Chrome 100+) |
| Inside an iframe | Needs allow="hid"; workers supported from Chrome 131 |
Typical flow
- Click
- requestDevice() with usagePage/usage filters
- open()
- Listen for inputreport events and call sendReport() or sendFeatureReport()
Data you get
What comes back: Raw HID input, output and feature reports
Shape: stream
How often: event per report; device rate (125 to 1000 Hz typical)
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
vendorId | integer | None | 0 to 65535 | Not listed |
productId | integer | None | 0 to 65535 | Not listed |
productName | string | None | device defined | Not listed |
collections[].usagePage / usage | integer | None | HID usage tables | Not listed |
reportId | integer | None | 0 to 255 | Not listed |
data | binary | bytes | report size per descriptor (often 8 to 64) | Not listed |
Technical limits
- Chrome blocks FIDO security keys, and usages for keyboards and mice are blocklisted so a site cannot capture keystrokes
- Not available on Android Chrome, Firefox, Safari
- Needs HTTPS
- Blocklist maintained in Chromium hid_blocklist
The story
What it is
A site can read and write raw data from a keyboard, pad or other device you pick.
For you
A picker shows devices like a controller or macro pad. You choose one, and the page can use all its special buttons and lights.
For makers
Makers can support odd or high end devices that the standard gamepad tool misses. It is how a web page can set up a keyboard or a PlayStation controller.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A web page reads every button on a PlayStation controller and updates its firmware. | None named |
| creative | A web page lets you remap keys on a custom keyboard. | VIA, QMK |
| enterprise | A web point of sale reads a barcode or card reader. | None named |
| accessibility | A web app uses a special switch device for people with limited movement. | None named |
| live | A stream deck style pad controls scenes from a web page. | Elgato |
| security | A bad page could ask for a keyboard device and read what you type on it, so the picker matters. | None named |
Risks
- Keystroke exposure
- Not on Safari
What the platform says
- Google: WebHID. Chrome's docs say WebHID lets pages talk to special keyboards, gamepads and other human interface devices.
Good uses and abuse
Legitimate uses
- Game controller remapping
- LED and macro keyboards (VIA, QMK)
- Lab and medical hardware
Known abuse
- Hardware fingerprinting after one grant
- Social engineering around a fake device setup
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 4 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2021-03, Chrome 89: WebHID ships on desktop Chrome and Edge
- 2022-01, Chrome 100: device.forget()
- 2024-11, Chrome 131: WebHID in dedicated and shared workers
Related capabilities
Related
- WebUSB. Can talk to one USB device you pick from a list
- Gamepad API and haptics. Can see your game controller after you press a button, and make it rumble
Sources
How well checked: Checked against real behavior.