--- title: Bluetooth slug: Web/API/Bluetooth tags: - API - Bluetooth - Experimental - Interface - NeedsTranslation - Reference - TopicStub - Web Bluetooth API translation_of: Web/API/Bluetooth ---

{{APIRef("Bluetooth API")}}{{securecontext_header}}{{SeeCompatTable}}

The Bluetooth interface of the Web Bluetooth API returns a {{jsxref("Promise")}} to a {{domxref("BluetoothDevice")}} object with the specified options.

Interface

interface Bluetooth : EventTarget {
  [SecureContext] Promise<boolean> getAvailability();
  [SecureContext] attribute EventHandler onavailabilitychanged;
  [SecureContext, SameObject] readonly attribute BluetoothDevice? referringDevice;
  [SecureContext] Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
};
Bluetooth implements BluetoothDeviceEventHandlers;
Bluetooth implements CharacteristicEventHandlers;
Bluetooth implements ServiceEventHandlers;

Properties

Inherits properties from its parent {{domxref("EventTarget")}}.

{{domxref("Bluetooth.referringDevice")}} {{readonlyinline}}
Returns a reference to the device, if any, from which the user opened the current page. For example, an Eddystone beacon might advertise a URL, which the user agent allows the user to open. A BluetoothDevice representing the beacon would be available through navigator.bluetooth.referringDevice.

Events

{{domxref("Bluetooth.onavailabilitychanged")}}
An event handler that runs when an event of type {{event("availabilitychanged")}} has fired.

Methods

{{domxref("Bluetooth.getAvailability()")}}
Returns a {{jsxref("Promise")}} that resolved to a {{jsxref("Boolean")}} indicating whether the user-agent has the ability to support Bluetooth. Some user-agents let the user configure an option that affects what is returned by this value. If this option is set, that is the value returned by this method.
{{domxref("Bluetooth.requestDevice()")}}
Returns a {{jsxref("Promise")}} to a {{domxref("BluetoothDevice")}} object with the specified options.

Specifications

Specification Status Comment
{{SpecName('Web Bluetooth', '#bluetooth', 'Bluetooth')}} {{Spec2('Web Bluetooth')}} Initial definition.

Browser compatibility

{{Compat("api.Bluetooth")}}