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 in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers, except for Shared Web Workers.
The sendReport() method of the HIDDevice interface sends an output report to the HID device.
The reportId for each of the report formats that this device supports can be retrieved from HIDDevice.collections.
sendReport(reportId, data)
reportIdAn 8-bit report ID. If the HID device does not use report IDs, send 0.
dataBytes as an ArrayBuffer, a TypedArray, or a DataView.
A Promise that resolves with undefined once the report has been sent.
NotAllowedError DOMException
Thrown if sending the report fails for any reason.
The example below shows how to make a Joy-Con device rumble using output reports. You can see more examples, and live demos in the article Connecting to uncommon HID devices.
// First, send a command to enable vibration. // Magical bytes come from https://github.com/mzyy94/joycon-toolweb const enableVibrationData = [1, 0, 1, 64, 64, 0, 1, 64, 64, 0x48, 0x01]; await device.sendReport(0x01, new Uint8Array(enableVibrationData)); // Then, send a command to make the Joy-Con device rumble. // Actual bytes are available in the sample. const rumbleData = [ /* … */ ]; await device.sendReport(0x10, new Uint8Array(rumbleData));
| Specification |
|---|
| WebHID API> # dom-hiddevice-sendreport> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
sendReport |
89 | 89 | No | 75 | No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HIDDevice/sendReport