Can Chrome extensions communicate with USB-devices?

879 views Asked by At

Chrome Apps can use the Chrome.usb and Chrome.hid apis. These are deprecated, when writing Chrome extensions. Is it possible to use web.usb or web.hid in the popup html?

In my popup.js this

if ("hid" in navigator)

returns "True"

1

There are 1 answers

0
nondebug On

Yes, you can access WebUSB and WebHID from the extension's background page however requesting permission to access a device requires making a call from a tab (not a pop-up or the background page).

Note that the background page is deprecated with Manifest V3. Extensions are expected to migrate to Service Workers. Currently, WebUSB and WebHID are not accessible from Service Workers. Supporting this is being investigated in https://crbug.com/1303193 and https://crbug.com/1303195.