Chrome and the Web APIs

Browser is becoming better by the day and Chrome is at the forefront of this movement. There are a plethora of interesting Web APIs that will redefine the browser in the near future. It won’t be far wrong if we extended the Javascript prophecy to the browsers – ‘anything that can be done in a browser will be done in the browser in the future’, and it’s true to a large extent even now, i.e., Chromebook.

I recently came across Bluetooth API that landed in Chrome canary recently. It doesn’t do much right now, but, it’s a start. To see it in action:

1. I enabled the ‘Enable experimental web platform features’ in chrome://flags for my local Chrome canary installation
2. Restarted the browser
3. Connected the phone to the mac via bluetooth
4. Opened Chrome developer tools and ran the following command:

navigator.bluetooth.requestDevice().then(
    function(d) {
       console.log('Found a device', d);
   },
   function(e) {
      console.log('Exception', e);
   });

5. It returned straight-away with the following output:

Found a device BluetoothDevice {instanceId: "E0:CB:EE:84:F7:C2"}

6. requestDevice() returns a promise and you can attach the appropriate resolve and reject callbacks with it.

That’s well and good, but what can I really do with this?

Just off the top of my head:

  • take a phone call on your computer
  • transfer data
  • transfer audio
  • …and lots more, in the future

About andhapp

Namastey (Hello) Stranger, This is not the geekiest blog on the planet yet it is not the dumbest one either. I am a small time developer who likes to explore new technologies. I usually program in Java, Groovy and Ruby and take keen interest in the surrounding geeky developments.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>