Bluetooth: getDevices() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The getDevices() method of the Bluetooth interface returns an array containing the Bluetooth devices that this origin is allowed to access — including those that are out of range and powered off.

Syntax

js
getDevices()

Parameters

None.

Return value

A Promise that resolves with an array of BluetoothDevice objects.

Exceptions

SecurityError DOMException

Thrown if this operation is not permitted in this context due to security concerns, such as being called when access to the current document is blocked by the Permissions Policy directive bluetooth.

Specifications

Specification
Web Bluetooth
# dom-bluetooth-getdevices

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getDevices
Experimental
Chrome – No support
Chrome 85 (Release date: 2020-08-25)
disabled
disabled From version 85 users must explicitly set the #enable-experimental-web-platform-features preference to enabled. To change preferences in Chrome, visit chrome://flags.
Edge – No support
Edge 85 (Release date: 2020-08-27)
disabled
disabled From version 85 users must explicitly set the #enable-experimental-web-platform-features preference to enabled. To change preferences in Edge, visit about:flags.
Firefox – No support
Firefox
footnote
footnote See bug 674737
Opera – No support
Opera 71 (Release date: 2020-09-15)
disabled
disabled From version 71 users must explicitly set the #enable-experimental-web-platform-features preference to enabled. To change preferences in Opera, visit opera://flags.
Safari – No support
Safari
footnote
footnote See bug 101034
Chrome Android – No support
Chrome Android 85 (Release date: 2020-08-25)
disabled
disabled From version 85 users must explicitly set the #enable-experimental-web-platform-features preference to enabled. To change preferences in Chrome Android, visit chrome://flags.
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 674737
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 101034
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote
footnote See bug 101034

Legend

Tip: you can click/tap on a cell for more information.

No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.