Short Bytes: Two Google developers, Reilly Grant and Ken Rockot, have uploaded a draft document to theÂ World Wide Web Consortiumâ€™s Web Incubator Community Group (W3C WICG), describing a new way to directly connect USB devices to the web. This is being called WebUSB and itâ€™ll make the process ofÂ connecting a device to a web page simpler.
Dubbed WebUSB API, aÂ new API calls itself as a â€śway to safely expose USB device services to the Webâ€ť. Developed by two Googlers, it aims to take â€śplug and playâ€ť to the next level for connecting devices by harnessing the power of web technologies.
This API covers all types of devices that are connected to your PC via USB ports â€” keyboards, IoT equipment, mice, etc.
Letâ€™s tell you about WebUSB API in detail:
What is WebUSB API?
WebUSB wants to make the process of connecting a device to a web page simple. However, Googlers donâ€™t try to label it as a universal method.Â â€śWebUSB does not attempt to provide a general mechanism for any web page to connect to any USB device,â€ť they explain.
How to use WebUSB API â€” a simple example
Letâ€™s take an example of a 3D printer. These days you canâ€™t go to Thingiverse and hit Ctrl+P to print design out of your 3D printer. This is so because user agents and operating systems do not have 3D printer support.
The security and privacy concern with WebUSB API
The developers call security and privacy issueÂ their biggest concern. As a computer automatically trusts a USB device and vice versa, developers are looking to make aÂ type ofÂ Cross-Origin Resource Sharing (CORS). This will prevent web pages from requesting data from anything other than the page youâ€™re visiting.
This will restrict a webpage to use the USB device to access your computer or any files in the USB device.