coderef

WebHIDLimited availability

The WebHID API provides access to Human Interface Devices (HID) that are connected to the user's device.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–88Not supported
89+Supportedsince Mar 2, 2021
Current: 155
Edge
12–88Not supported
89+Supportedsince Mar 4, 2021
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
✕Not supportedup to 155
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Firefox, Safari, Chrome Android, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: HID.

Feature detection

JS · check before using
if ("HID" in globalThis) {
  // HID is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (33). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HID8989✕✕✕✕✕
HID.connect_event8989✕✕✕✕✕
HID.disconnect_event8989✕✕✕✕✕
HID.getDevices8989✕✕✕✕✕
HID.requestDevice8989✕✕✕✕✕
HID.worker_support✕✕✕✕✕✕✕
HIDConnectionEvent8989✕✕✕✕✕
HIDConnectionEvent.HIDConnectionEvent8989✕✕✕✕✕
HIDConnectionEvent.device8989✕✕✕✕✕
HIDConnectionEvent.worker_support✕✕✕✕✕✕✕
HIDDevice8989✕✕✕✕✕
HIDDevice.close8989✕✕✕✕✕
HIDDevice.collections8989✕✕✕✕✕
HIDDevice.forget100100✕✕✕✕✕
HIDDevice.inputreport_event8989✕✕✕✕✕
HIDDevice.open8989✕✕✕✕✕
HIDDevice.opened8989✕✕✕✕✕
HIDDevice.productId8989✕✕✕✕✕
HIDDevice.productName8989✕✕✕✕✕
HIDDevice.receiveFeatureReport8989✕✕✕✕✕
Show 13 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HIDDevice.sendFeatureReport8989✕✕✕✕✕
HIDDevice.sendReport8989✕✕✕✕✕
HIDDevice.vendorId8989✕✕✕✕✕
HIDDevice.worker_support✕✕✕✕✕✕✕
HIDInputReportEvent8989✕✕✕✕✕
HIDInputReportEvent.data8989✕✕✕✕✕
HIDInputReportEvent.device8989✕✕✕✕✕
HIDInputReportEvent.reportId8989✕✕✕✕✕
HIDInputReportEvent.worker_support✕✕✕✕✕✕✕
Navigator.hid8989✕✕✕✕✕
WorkerNavigator.hid131131✕✕✕✕✕
iframe.allow.hid8989✕✕89✕✕
http.headers.Permissions-Policy.hid8989✕✕✕✕✕