← Back to release summary

Web Bluetooth getAvailability()

Category
Device
Type
New or changed feature
Status
Enabled by default (Chrome 78)
Intent stage
Evaluate readiness to ship

WPT details: The change that implements this API contains WPT. https://chromium-review.googlesource.com/c/chromium/src/+/1651516

Summary

getAvailability() returns a promise that resolves with true if the user agent is running on a system that has a Bluetooth radio and false otherwise. The powered state of the Bluetooth radio does not influence the availability because applications can prompt users to turn on the radio using requestDevice(). The availabilitychanged event can be used to detect changes in the availability of the Bluetooth radio.

Motivation

This API is useful for developers to know whether they should show UI for Web Bluetooth or not to the user.

Standards & signals

Ecosystem

Docs: https://chromium-review.googlesource.com/c/chromium/src/+/1651516

Samples: https://googlechrome.github.io/samples/web-bluetooth/availability.html https://googlechrome.github.io/samples/web-bluetooth/availability-async-await.html

View on chromestatus.com