HID
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
Note: This feature is available inWeb Workers, except forShared Web Workers.
TheHID interface provides methods for connecting toHID devices, listing attached HID devices and event handlers for connected HID devices.
In this article
Instance properties
This interface also inherits properties of its parent,EventTarget.
Instance methods
This interface also inherits methods of its parent,EventTarget.
getDevices()ExperimentalReturns a
Promisethat resolves with an array of connected HID devices that the user has previously been granted access to in response to arequestDevice()call.requestDevice()ExperimentalReturns a
Promisethat resolves with an array of connectedHIDDeviceobjects. Calling this function will trigger the user agent's permission flow in order to gain permission to access one selected device from the returned list of devices.
Events
connectExperimentalFired when an HID device is connected.
disconnectExperimentalFired when an HID device is disconnected.
Specifications
| Specification |
|---|
| WebHID API> # dom-hid> |