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

BCD tables only load in the browser