我想通过蓝牙将移动请求数据传送到网络浏览器(笔记本电脑),因此我的第一步是将系统蓝牙连接到网络浏览器,但收到错误消息通过使用下面的代码。或者有没有其他的方式通过蓝牙连接手机到网页浏览器来传输数据?网络蓝牙 - 通过蓝牙将移动设备连接到网络浏览器时出现错误
navigator.bluetooth.requestDevice().then(
function (d){console.log("found Device !!");},
function (e){console.log("Oh no !!",e);});
我在铬上面的代码尝试。
错误消息:
TypeError: Failed to execute 'requestDevice' on 'Bluetooth': 1 argument required, but only 0 present
如果你告诉我们该错误消息,我们能做的不仅仅是猜测更多。 – Connum
@Connum - 是的,它是标题,我更新。 – 151291
您需要为'requestDevice'方法的参数提供'options'对象。文档在https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice和https://googlechrome.github.io/samples/web-bluetooth/device-info.html应该会让你从正确的方向开始 –