安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
蓝牙
接口在
Web Bluetooth API
返回
Promise
到
BluetoothDevice
object with the specified options.
interface Bluetooth : EventTarget {
Promise<boolean> getAvailability();
attribute EventHandler onavailabilitychanged;
[SameObject]
readonly attribute BluetoothDevice? referringDevice;
Promise<sequence<BluetoothDevice>> getDevices();
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
};
Bluetooth includes BluetoothDeviceEventHandlers;
Bluetooth includes CharacteristicEventHandlers;
Bluetooth includes ServiceEventHandlers;
Inherits properties from its parent
EventTarget
.
Bluetooth.referringDevice
只读
navigator.bluetooth.referringDevice
.
Bluetooth.onavailabilitychanged
availabilitychanged
has fired.
Bluetooth.getAvailability()
Promise
that resolved to a
布尔
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.
Bluetooth.getDevices()
Promise
that resolved to an array of
BluetoothDevice
s which the origin already obtained permission for via a call to
Bluetooth.requestDevice()
.
Bluetooth.requestDevice()
Promise
到
BluetoothDevice
object with the specified options.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web Bluetooth
The definition of 'Bluetooth' in that specification. |
草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
蓝牙
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
getAvailability
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
onavailabilitychanged
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
referringDevice
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
requestDevice
|
Chrome
56
|
Edge
≤79
|
Firefox No | IE No |
Opera
43
|
Safari No | WebView Android No | Chrome Android 56 | Firefox Android No | Opera Android 43 | Safari iOS No | Samsung Internet Android 6.0 |
完整支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。
蓝牙