Search code examples
javascriptchromiumwebusb

WebUSB navigator.usb cannot be used to see if a browser got support


Since there's many Chromium based browsers out there I have been able to test if the web USB API is available using the navigator.usb object. But I have come to understand that many of these browsers don't respond to any request even though they have the navigator.usb object defined. Can I use some other way of knowing if the browser will understand the API?

  • Opera will open up the dialog but nothing happens when I select a device.
  • Kiwi on Android will crash
  • DuckDuckGo on Android will just ignore my calls

etc...


Solution

  • In general the sounds like a bug in each of the listed browsers and I recommend filing issues through their various support mechanisms. Given the current behavior I unfortunately have to recommend checking the User Agent string to detect browsers that have known issues.

    The current structure of the Chromium code makes it easy for Chromium-derived browsers to get this wrong. Issue 991759 tracks a refactoring which should make it easier for browsers other than Chrome to share more of the WebUSB implementation or turn it off in a less confusing way.