8
votes

Is there a way to make a browser aware of iBeacon devices in its proximity?

Similar to the way HTML5 Geolocation is working...

If not would this be something that can be achieved with a browser plug-in that can provide the detail to be consumed by javascript?

3

3 Answers

5
votes

Unfortunately, no. No web browsers have implemented any bridges between beacon detection and JavaScript.

I don't think a plugin approach is possible on mobile browsers (either iOS or Android), because neither browser supports asynchronous communication between external apps and JavaScript in Mobile Safari / Mobile Chrome. The best you could do is have a custom app that responds to a beacon, then launches a web page in the browser. But I realize that isn't what you are asking for.

If you want to build a native app with JavaScript, you can use Cordova (aka PhoneGap) and use plugins that provide beacon support. My company has one for our ProximityKit beacon framework:

https://github.com/RadiusNetworks/proximitykit-plugin-cordova

There is also a Cordova plugin that has basic beacon support here:

https://github.com/petermetz/cordova-plugin-ibeacon

3
votes

This looks promising (2016), Google Chrome developers site showing a desktop browser feature as a work in progress.

https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en

Even though the Web Bluetooth API specification is not finalized yet, the Chrome Team is actively looking for enthusiastic developers (I mean you) to try out this work-in-progress API and give feedback on the spec and feedback on the implementation.

Web Bluetooth API is currently available to be enabled experimentally on your origin in Origin Trials, or locally on your machine using an experimental flag. The implementation is partially complete and currently available on Chrome OS, Chrome for Android M, Linux, and Mac.

Go to chrome://flags/#enable-web-bluetooth, enable the highlighted flag, restart Chrome and you should be able to scan for and connect to nearby Bluetooth devices, read/write Bluetooth characteristics, receive GATT Notifications and know when a Bluetooth device gets disconnected.

https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md

1
votes

There's a W3C specification for this Web Bluetooth, but there's no support yet: http://caniuse.com/#search=bluetooth.

If you decide to write a Phonegap plugin implementing this spec will be a good starting point.