Bluetooth.getDevices()
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The getDevices()
method of Bluetooth
interface of Web Bluetooth API exposes the Bluetooth devices this origin is allowed to access. This method does not display any permission prompts.
Note: This method returns a BluetoothDevice
for each device the origin is currently allowed to access, even the ones that are out of range or powered off.
Syntax
var readerPromise = Bluetooth.getDevices();
Parameters
None.
Return value
A Promise
that resolves with an array of BluetoothDevice
s.
Exceptions
This method doesn't throw any exceptions.
Specifications
Specification |
---|
Web Bluetooth # dom-bluetooth-getdevices |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getDevices |
85 |
85 |
No |
No |
71 |
No |
No |
85 |
No |
No |
No |
No |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/getDevices