Limited availability
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The getDevices
method of the USB
interface returns a Promise
that resolves with an array of USBDevice
objects for paired attached devices. For information on pairing devices, see USB.requestDevice()
.
None.
Return valueA Promise
that resolves with an array of USBDevice
objects.
The following example logs the product name and serial number of paired devices to the console. For information on pairing devices, see USB.requestDevice()
.
navigator.usb.getDevices().then((devices) => {
console.log(`Total devices: ${devices.length}`);
devices.forEach((device) => {
console.log(
`Product name: ${device.productName}, serial number ${device.serialNumber}`,
);
});
});
Specifications Browser compatibility
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4