← Back to release summary

Web Bluetooth getDevices() and forget()

Category
Device
Type
New or changed feature
Status
In developer trial (Behind a flag) (Chrome 169)
Intent stage
Prepare to ship

WPT details: Web platform tests will be added as this feature is implemented. The tests will use the Web Bluetooth testing API and will be added to the wpt/bluetooth directory. https://github.com/web-platform-tests/wpt/tree/master/bluetooth

Summary

Chrome's implementation of Web Bluetooth does not have a way for websites to get a list of permitted devices. This feature adds the Bluetooth.getDevices() and BluetoothDevice.forget methods. getDevices() will return a list of BluetoothDevice objects that the current origin has been granted permission to use by the user. forget() will allow web developers to voluntarily revoke a permission to a BluetoothDevice that was granted by a user.

Motivation

Not being able to query for a list of permitted devices without having to display a permission prompt has been a pain point of using the Web Bluetooth API. Instead, a site has to call navigator.bluetooth.requestDevice() and have the user choose a device from the device chooser prompt on every visit to the page. This is also annoying for users who have to deal with a permission prompt on every visit to the site. This is even more frustrating if the user has multiple Bluetooth devices to connect because the prompt can only grant permission to one device at a time.

Standards & signals

Ecosystem

Docs: https://docs.google.com/document/d/1h3uAVXJARHrNWaNACUPiQhLt7XI-fFFQoARSs1WgMDM/edit#heading=h.jdnga4sjs82y

Samples: https://googlechrome.github.io/samples/web-bluetooth/get-devices.html

Explainers: https://docs.google.com/document/d/1h3uAVXJARHrNWaNACUPiQhLt7XI-fFFQoARSs1WgMDM/edit#heading=h.jdnga4sjs82y

View on chromestatus.com