WebUSB
WebUSB is a JavaScript application programming interface (API) specification for securely providing access to USB devices from web applications.[src] It was published by the Web Platform Incubator Community Group.[src] As of July 2021, it is in Draft Community status, and is supported by Chromium-based browsers.[src]
WebUSB is a JavaScript application programming interface (API) specification for securely providing access to USB devices from web applications.[src] It was published by the Web Platform Incubator Community Group.[src] As of July 2021, it is in Draft Community status, and is supported by Chromium-based browsers.[src] navigator.usb.requestDevice({ filters: [{ vendorId: 0x2341 }] }) .then(device => { console.log(device.productName); console.log(device.manufacturerName); }) .catch(error => { console.error(error); }); The USB device descriptor returned from the above snippet will contain all important information about the device such as; version, packet size, configuration options etc.[src] The alternative call to navigator.usb.getDevices() will instead look like this; navigator.usb.getDevices().then(devices => { devices.forEach(device => { console.log(device.productName); console.log(device.manufacturerName); }); }) In order to talk to the device there are a few important function calls to run through.[src] device.open() will run through all the required steps of setting up the device, device.selectConfiguration() sets up the configuration, importantly how it is powered, and the number of interfaces.[src] It is then important to claim the interface.[src] This can be done through the device.claimInterface function call.[src] This will simulate a real wired connection and ensure that this web page is the only one able to read and write to the device until the connection is released.[src] Finally the call device.controlTransferOut() will set up the device to communicate through the WebUSB Serial API.[src] Once the set up is all done, data can be transferred to the device using device.transferIn() to transfer bulk data to the device, similarly its sister function device.transferOut() to read data from the device.[src]
14 sentences · 14 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"WebUSB." encyclopegia.org, 2025, https://encyclopegia.org/wiki/webusb. Accessed 25 November 2026.
Chicago
"WebUSB." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/webusb.
APA
encyclopegia.org. (2025). WebUSB. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/webusb
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON