Web Bluetooth
The Web Bluetooth API enables selecting and communicating with nearby Bluetooth devices. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Overview
The Web Bluetooth API enables selecting and communicating with nearby Bluetooth devices. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
Bluetooth Experimental | 70 | 79 | | | 56 | |
getAvailability Experimental The getAvailability() method of the Bluetooth interface nominally returns true if the user agent can support Bluetooth (because the device has a Bluetooth adapter), and false otherwise. | 78 | 79 | | | 78 | |
getDevices Experimental 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. | 85 | 85 | | | 85 | |
requestDevice Experimental The Bluetooth.requestDevice() method of the Bluetooth interface returns a Promise that fulfills with a BluetoothDevice object matching the specified options. If there is no chooser UI, this method returns the first device matching the criteria. | 56 | 79 | | | 56 | |
requestDevice (options exclusionFilters parameter) Experimental `options.exclusionFilters` parameter | 114 | 114 | | | 114 | |
requestDevice (options filter manufacturerData parameter) Experimental `options.filter.manufacturerData` parameter | 92 | 92 | | | 92 | |
BluetoothCharacteristicProperties Experimental The BluetoothCharacteristicProperties interface of the Web Bluetooth API provides the operations that are valid on the given BluetoothRemoteGATTCharacteristic. | 70 | 79 | | | 56 | |
authenticatedSignedWrites Experimental The authenticatedSignedWrites read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if signed writing to the characteristic value is permitted. | 56 | 79 | | | 56 | |
broadcast Experimental The broadcast read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if the broadcast of the characteristic value is permitted using the Server Characteristic Configuration Descriptor. | 56 | 79 | | | 56 | |
indicate Experimental The indicate read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if indications of the characteristic value with acknowledgement is permitted. | 56 | 79 | | | 56 | |
notify Experimental The notify read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if notifications of the characteristic value without acknowledgement is permitted. | 56 | 79 | | | 56 | |
read Experimental The read read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if the reading of the characteristic value is permitted. | 56 | 79 | | | 56 | |
reliableWrite Experimental The reliableWrite read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if reliable writes to the characteristic is permitted. | 56 | 79 | | | 56 | |
writableAuxiliaries Experimental The writableAuxiliaries read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if reliable writes to the characteristic descriptor is permitted. | 56 | 79 | | | 56 | |
write Experimental The write read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if the writing to the characteristic with response is permitted. | 56 | 79 | | | 56 | |
writeWithoutResponse Experimental The writeWithoutResponse read-only property of the BluetoothCharacteristicProperties interface returns a boolean that is true if the writing to the characteristic without response is permitted. | 56 | 79 | | | 56 | |
BluetoothDevice Experimental The BluetoothDevice interface of the Web Bluetooth API represents a Bluetooth device inside a particular script execution environment. | 70 | 79 | | | 56 | |
gatt Experimental The BluetoothDevice.gatt read-only property returns a reference to the device's BluetoothRemoteGATTServer. | 56 | 79 | | | 56 | |
gattserverdisconnected_event Experimental `gattserverdisconnected` event | 56 | 79 | | | 56 | |
id Experimental The BluetoothDevice.id read-only property returns a string that uniquely identifies a device. | 56 | 79 | | | 56 | |
name Experimental The BluetoothDevice.name read-only property returns a string that provides a human-readable name for the device. | 56 | 79 | | | 56 | |
BluetoothRemoteGATTCharacteristic Experimental The BluetoothRemoteGattCharacteristic interface of the Web Bluetooth API represents a GATT Characteristic, which is a basic data element that provides further information about a peripheral's service. | 70 | 79 | | | 56 | |
characteristicvaluechanged_event Experimental `characteristicvaluechanged` event | 56 | 79 | | | 56 | |
getDescriptor Experimental The BluetoothRemoteGATTCharacteristic.getDescriptor() method returns a Promise that resolves to the first BluetoothRemoteGATTDescriptor for a given descriptor UUID. | 57 | 79 | | | 57 | |
getDescriptors Experimental The BluetoothRemoteGATTCharacteristic.getDescriptors() method returns a Promise that resolves to an Array of all BluetoothRemoteGATTDescriptor objects for a given descriptor UUID. | 57 | 79 | | | 57 | |
properties Experimental The BluetoothRemoteGATTCharacteristic.properties read-only property returns a BluetoothCharacteristicProperties instance containing the properties of this characteristic. | 56 | 79 | | | 56 | |
readValue Experimental The BluetoothRemoteGATTCharacteristic.readValue() method returns a Promise that resolves to a DataView holding a duplicate of the value property if it is available and supported. Otherwise it throws an error. | 56 | 79 | | | 56 | |
service Experimental The BluetoothRemoteGATTCharacteristic.service read-only property returns the BluetoothRemoteGATTService this characteristic belongs to. | 56 | 79 | | | 56 | |
startNotifications Experimental The BluetoothRemoteGATTCharacteristic.startNotifications() method returns a Promise to the BluetoothRemoteGATTCharacteristic instance when there is an active notification on it. | 56 | 79 | | | 56 | |
stopNotifications Experimental The BluetoothRemoteGATTCharacteristic.stopNotifications() method returns a Promise to the BluetoothRemoteGATTCharacteristic instance when there is no longer an active notification on it. | 56 | 79 | | | 56 | |
uuid Experimental The BluetoothRemoteGATTCharacteristic.uuid read-only property returns a string containing the UUID of the characteristic, for example '00002a37-0000-1000-8000-00805f9b34fb' for the Heart Rate Measurement characteristic. | 56 | 79 | | | 56 | |
value Experimental The BluetoothRemoteGATTCharacteristic.value read-only property returns currently cached characteristic value. This value gets updated when the value of the characteristic is read or updated via a notification or indication. | 56 | 79 | | | 56 | |
writeValueWithoutResponse Experimental The BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse() method sets a BluetoothRemoteGATTCharacteristic object's value property to the bytes contained in a given ArrayBuffer, TypedArray, or DataView, writes the characteristic value without response, and returns the resulting Promise. | 85 | 85 | | | 85 | |
writeValueWithResponse Experimental The BluetoothRemoteGATTCharacteristic.writeValueWithResponse() method sets a BluetoothRemoteGATTCharacteristic object's value property to the bytes contained in a given ArrayBuffer, TypedArray, or DataView, writes the characteristic value with required response, and returns the resulting Promise. | 85 | 85 | | | 85 | |
BluetoothRemoteGATTDescriptor Experimental The BluetoothRemoteGATTDescriptor interface of the Web Bluetooth API provides a GATT Descriptor, which provides further information about a characteristic's value. | 70 | 79 | | | 57 | |
characteristic Experimental The BluetoothRemoteGATTDescriptor.characteristic read-only property returns the BluetoothRemoteGATTCharacteristic this descriptor belongs to. | 57 | 79 | | | 57 | |
readValue Experimental The BluetoothRemoteGATTDescriptor.readValue() method returns a Promise that resolves to a DataView holding a duplicate of the value property if it is available and supported. Otherwise it throws an error. | 57 | 79 | | | 57 | |
uuid Experimental The BluetoothRemoteGATTDescriptor.uuid read-only property returns the UUID of the characteristic descriptor. For example "00002902-0000-1000-8000-00805f9b34fb" for the Client Characteristic Configuration descriptor. | 57 | 79 | | | 57 | |
value Experimental The BluetoothRemoteGATTDescriptor.value read-only property returns a DataView containing the currently cached descriptor value. This value gets updated when the value of the descriptor is read. | 57 | 79 | | | 57 | |
writeValue Experimental The BluetoothRemoteGATTDescriptor.writeValue() method sets the value property to the bytes contained in an ArrayBuffer, TypedArray, or DataView and returns a Promise. | 57 | 79 | | | 57 | |
BluetoothRemoteGATTServer Experimental The BluetoothRemoteGATTServer interface of the Web Bluetooth API represents a GATT Server on a remote device. | 70 | 79 | | | 56 | |
connect Experimental The BluetoothRemoteGATTServer.connect() method causes the script execution environment to connect to this.device. | 56 | 79 | | | 56 | |
connected Experimental The BluetoothRemoteGATTServer.connected read-only property returns a boolean value that returns true while this script execution environment is connected to this.device. It can be false while the user agent is physically connected. | 56 | 79 | | | 56 | |
device Experimental The BluetoothRemoteGATTServer.device read-only property returns a reference to the BluetoothDevice running the server. | 56 | 79 | | | 56 | |
disconnect Experimental The BluetoothRemoteGATTServer.disconnect() method causes the script execution environment to disconnect from this.device. | 56 | 79 | | | 56 | |
getPrimaryService Experimental The BluetoothRemoteGATTServer.getPrimaryService() method returns a promise to the primary BluetoothRemoteGATTService offered by the Bluetooth device for a specified bluetooth service UUID. | 56 | 79 | | | 56 | |
getPrimaryServices Experimental The BluetoothRemoteGATTServer.getPrimaryServices() method returns a promise to a list of primary BluetoothRemoteGATTService objects offered by the Bluetooth device for a specified BluetoothServiceUUID. | 56 | 79 | | | 56 | |
BluetoothRemoteGATTService Experimental The BluetoothRemoteGATTService interface of the Web Bluetooth API represents a service provided by a GATT server, including a device, a list of referenced services, and a list of the characteristics of this service. | 70 | 79 | | | 56 | |
device Experimental The BluetoothGATTService.device read-only property returns information about a Bluetooth device through an instance of BluetoothDevice. | 56 | 79 | | | 56 | |
getCharacteristic Experimental The BluetoothGATTService.getCharacteristic() method returns a Promise to an instance of BluetoothRemoteGATTCharacteristic for a given universally unique identifier (UUID). | 56 | 79 | | | 56 | |
getCharacteristics Experimental The BluetoothGATTService.getCharacteristics() method returns a Promise to a list of BluetoothRemoteGATTCharacteristic instances for a given universally unique identifier (UUID). | 56 | 79 | | | 56 | |
isPrimary Experimental The BluetoothGATTService.isPrimary read-only property returns a boolean value that indicates whether this is a primary service. If it is not a primary service, it is a secondary service. | 56 | 79 | | | 56 | |
uuid Experimental The BluetoothGATTService.uuid read-only property returns a string representing the UUID of this service. | 56 | 79 | | | 56 | |
| The BluetoothUUID interface of the Web Bluetooth API provides a way to look up Universally Unique Identifier (UUID) values by name in the registry maintained by the Bluetooth SIG. | 70 | 79 | | | 56 | |
canonicalUUID_static Experimental The canonicalUUID() static method of the BluetoothUUID interface returns the 128-bit UUID when passed a 16- or 32-bit UUID alias. | 56 | 79 | | | 56 | |
getCharacteristic_static Experimental The getCharacteristic() static method of the BluetoothUUID interface returns a UUID representing a registered characteristic when passed a name or the 16- or 32-bit UUID alias. | 56 | 79 | | | 56 | |
getDescriptor_static Experimental The getDescriptor() static method of the BluetoothUUID interface returns a UUID representing a registered descriptor when passed a name or the 16- or 32-bit UUID alias. | 56 | 79 | | | 56 | |
getService_static Experimental The getService() static method of the BluetoothUUID interface returns a UUID representing a registered service when passed a name or the 16- or 32-bit UUID alias. | 56 | 79 | | | 56 | |
bluetooth Experimental The bluetooth read-only property of the Navigator interface returns a Bluetooth object for the current document, providing access to Web Bluetooth API functionality. | 70 | 79 | | | 56 | |
| Other | ||||||
html.elements.iframe.allow.bluetooth Experimental | 104 | 104 | | | 104 | |
http.headers.Permissions-Policy.bluetooth Experimental The HTTP Permissions-Policy header bluetooth directive controls whether the current document is allowed to use the Web Bluetooth API. | 104 | 104 | | | 104 | |
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Requires an experimental browser flag to be enabled
- Requires an experimental browser flag to be enabled
- Requires an experimental browser flag to be enabled
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
- This browser only partially implements this feature
- Linux support is not enabled by default.
- Only supported on macOS.
- This feature was removed in a later browser version (70)
- This browser only partially implements this feature
- Linux support is not enabled by default.
Syntax
const device = await navigator.bluetooth.requestDevice({
filters: [{ services: ['heart_rate'] }]
});
const server = await device.gatt.connect();
const service = await server.getPrimaryService('heart_rate');
const char = await service.getCharacteristic('heart_rate_measurement'); Use cases
Use Web Bluetooth
Use Web Bluetooth when standard HTML needs a more specific platform feature, semantic signal, or browser capability.
Handle edge cases
Apply Web Bluetooth to solve a focused requirement without redesigning the whole page architecture.
Cautions
- Test Web Bluetooth in your target browsers and input environments before depending on it as a primary behavior.
- Provide a fallback path or acceptable degradation strategy when support is still limited.
Accessibility
- Make sure Web Bluetooth supports the intended task without making the page harder to perceive, understand, or operate.
Related links
Powered by web-features