JavaScript Navigator bluetooth Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.bluetooth is a read-only property that returns a Bluetooth object for the current document (MDN) — the entry point to the Web Bluetooth API.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.bluetooth. Start with this line.

JavaScript
navigator.bluetooth
CallWhat it does
navigator.bluetoothPrimary signature.

Built into the browser. Read navigator.bluetooth on Navigator — no import required.

Library declarations
JavaScript
navigator.bluetooth

Parameters

ParameterDescription
"bluetooth" in navigatorRequired. Feature detect
Secure contextRequired. HTTPS or localhost

Return Value

Return ValueDescription
*Bluetooth (read-only property)

JavaScript Examples

Example 1 — Feature Detect

Check the property and whether you are in a secure context.

JavaScript
const hasBt = "bluetooth" in navigator;
const secure = window.isSecureContext;

console.log("bluetooth:", hasBt);
console.log("secure context:", secure);

if (hasBt && secure) {
  console.log("ready to call Web Bluetooth APIs");
} else {
  console.log("not ready — missing API and/or HTTPS");
}
Try It Yourself

How It Works

  1. Use in. Safe check before touching navigator.bluetooth.
  2. Check HTTPS. isSecureContext must be true.
  3. Combine both. Only then call Bluetooth methods.
  4. No chooser yet. Detection alone does not ask for a device.

Example 2 — getAvailability()

Ask whether the user agent can support Bluetooth right now.

JavaScript
async function checkBluetooth() {
  if (!("bluetooth" in navigator)) {
    console.log("bluetooth missing");
    return;
  }
  const ok = await navigator.bluetooth.getAvailability();
  console.log("available:", ok);
}

checkBluetooth();
Try It Yourself

How It Works

  1. Detect first. Skip the call when the API is absent.
  2. Await the Promise. Result is a boolean.
  3. Interpret carefully. Some UAs let users configure the return value.
  4. Still need a click. Availability ≠ permission to a specific device.

Example 3 — requestDevice() Pattern

Open the chooser from a user gesture (button click).

JavaScript
async function pickDevice() {
  if (!("bluetooth" in navigator)) {
    console.log("bluetooth missing");
    return;
  }
  try {
    const device = await navigator.bluetooth.requestDevice({
      acceptAllDevices: true
    });
    console.log("picked:", device.name || "(unnamed)");
  } catch (err) {
    console.log("cancelled or failed:", err.name);
  }
}

// Call pickDevice() from a button click — not on page load.
Try It Yourself

How It Works

  1. User gesture. Call from a click handler, not on load.
  2. Pass options. Filters or acceptAllDevices: true.
  3. Await the device. Resolves to BluetoothDevice.
  4. Catch cancel. Dismissing the chooser rejects the Promise.

Browser Support

navigator.bluetooth is marked Experimental on MDN with limited availability — not Baseline. Support is incomplete; Chromium-based browsers are the usual targets.

✓ Experimental · Limited

Navigator.bluetooth

Returns a Bluetooth object for Web Bluetooth (availability + device requests). Secure context required. Feature-detect always.

Limited Not Baseline
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
bluetooth Check MDN

Bottom line: Treat Web Bluetooth as progressive enhancement behind feature checks. Provide a clear fallback when the API or hardware is unavailable.

Frequently Asked Questions

It is a read-only Navigator property that returns a Bluetooth object for the current document — the entry point to the Web Bluetooth API (availability checks and device requests).
Yes. MDN marks it Experimental and not Baseline (limited availability). Always feature-detect and check compatibility before production.
Yes. It is available only in secure contexts (HTTPS or localhost) in supporting browsers.
If navigator.bluetooth exists, call await navigator.bluetooth.getAvailability(), which resolves to a boolean. Some browsers let users configure what that method returns.
Call navigator.bluetooth.requestDevice(options) from a user gesture (for example a button click). It opens a chooser and resolves to a BluetoothDevice when the user picks a device.
No. The property is read-only. You use methods on the returned Bluetooth object such as getAvailability() and requestDevice().

Next: buildID

Learn the related Navigator buildID property.

buildID tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful