admin管理员组文章数量:1356329
Is there a way to access Bluetooth connected devices in browser?
I am trying to build a demo system utilizing leap motion for a university project and was planning to build the interface in HTML because leap motion supports JavaScript.
I want the system to have full control over Bluetooth calling on a phone. As most in-car systems currently do; i.e. accept call, decline, make call & view contacts(if possible)
Is there a way to access Bluetooth connected devices in browser?
I am trying to build a demo system utilizing leap motion for a university project and was planning to build the interface in HTML because leap motion supports JavaScript.
I want the system to have full control over Bluetooth calling on a phone. As most in-car systems currently do; i.e. accept call, decline, make call & view contacts(if possible)
Share Improve this question edited May 12, 2014 at 19:54 Giao1968 25.9k11 gold badges76 silver badges105 bronze badges asked May 12, 2014 at 19:53 Will_PWill_P 1031 gold badge3 silver badges10 bronze badges3 Answers
Reset to default 2You might want to check out the Chrome Bluetooth API, though it appears you need to have a development version of Chrome installed: https://developer.chrome./apps/bluetooth
After a trial during January 2017, this is now available in Chrome. Read this article by François Beaufort in developers.google.: https://developers.google./web/updates/2015/07/interact-with-ble-devices-on-the-web
You can do it with the Bluetooth Web API:
navigator.bluetooth.requestDevice({acceptAllDevices: true}).then(out => console.log(out))
Annoyingly it seems like the browser needs Bluetooth permission, and calling the code above fails with `Bluetooth permission has been blocked otherwise.
To allow bluetooth for macOS, add the app to System Preferences > Security & Privacy > Privacy > Bluetooth > Plus Button
:
本文标签: javascriptIs there a way to access Bluetooth connected devices in browserStack Overflow
版权声明:本文标题:javascript - Is there a way to access Bluetooth connected devices in browser? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743986980a2571445.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论