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
- Specification: https://webbluetoothcg.github.io/web-bluetooth/
- Firefox: Negative
- Safari: No signal — https://bugs.webkit.org/show_bug.cgi?id=101034
- Web developers: Positive
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=577953#c13
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=bluetooth
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Web%20Bluetooth%20getDevices()%20and%20forget()
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Web%20Bluetooth%20getDevices()%20and%20forget()
- Baseline status: https://webstatus.dev/?q=Web%20Bluetooth%20getDevices()%20and%20forget()
Samples: https://googlechrome.github.io/samples/web-bluetooth/get-devices.html
Explainers: https://docs.google.com/document/d/1h3uAVXJARHrNWaNACUPiQhLt7XI-fFFQoARSs1WgMDM/edit#heading=h.jdnga4sjs82y