How to configure Chrome to work with Web USB?
Configuring the Google Chrome browser to work with the Web USB API makes it possible for web applications to directly exchange data with peripheral devices connected via the Universal Serial Bus. This opens up huge prospects for creating cloud software capable of working with hardware keys, game controllers, specialized printers, and robotics.
The activation process starts with toggling an internal flag in the browser settings. Type the command chrome://flags in the address bar and press Enter to open the developer panel with hidden experimental features.
Use the search bar on the page to quickly find the flag named Web USB. Change its status using the dropdown list to Enabled, and then be sure to restart the browser by clicking the appearing restart confirmation button.
As with other low-level hardware access interfaces, security is of paramount importance. A website requesting access to hardware is required to operate via the secure HTTPS protocol; otherwise, the browser will block any attempts to initiate a communication session with devices.
When working with Web USB, the developer must explicitly request user permissions to access specific hardware. When the site calls the device request method, Chrome displays a system window with a list of available USB gadgets, and the user chooses which specific device to allow connecting to the site.
Using Web USB eliminates the need to write complex native drivers for each operating system. The web application receives direct, standardized access to the endpoints of the USB device, making the development of cross-platform hardware solutions fast and efficient.