Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble enabling webusb in chrome

I'm trying to enable webusb feature in chrome to test it. I' tryng to run this demo (https://github.com/webusb/arduino) locally on my webserver but it does not work, instead the version published on github works.

My setup:

  • Apache webserver virtual host with ssl support with self signed certificate
  • Last Google Chrome with webusb and experimental api flags enabled
  • Imported selfsigned certificate in Chrome to made it trust it like a valid cerficate
  • Remove origin trials meta from demo

But when I access the demo page I got javascript error because navigator.usb is undefined.

What's wrong in my setup, why navigator.usb is not enabled in my local setup but is enabled when I surf the online demo from the same browser?

like image 464
Fabiano Taioli Avatar asked Oct 15 '25 15:10

Fabiano Taioli


1 Answers

To get it up and running you have to enable Experimental Web Platform features, you can find these in the Chrome flags:

chrome://flags/#enable-experimental-web-platform-features

Now navigator.usb will be available, however, if you're developing on localhost you wont see any devices. To get devices showing up you should boot Chrome with --disable-webusb-security which will produce a notification announcing that security will suffer and allow you to see al your attached devices. For more extensive explanation take a look at https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web

like image 73
Joris Blaak Avatar answered Oct 18 '25 06:10

Joris Blaak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!