Web Bluetooth API in Chrome

navigator.bluetooth.requestDevice({ filters: [{ services: ['battery_service'] }] })
.then(device => {
  // Human-readable name of the device.
  console.log(device.name);
  // Indicates whether or not the device is paired with the system.
  console.log(device.paired);
  // Filtered UUIDs of GATT services the website origin has access to.
  console.log(device.uuids);

  // Attempts to connect to remote GATT Server.
  return device.connectGATT();
})
.then(server => {...})
.catch(error => { console.log(error); });

Web Bluetooth API is at the time of writing partially implemented in Chrome OS M45 behind an experimental flag. [Once enabled] you should be able to scan for and connect to nearby Bluetooth devices and read/write Bluetooth characteristics.

In future releases you should also be able to subscribe to notifications and stuff like that.

Interact with BLE devices on the Web →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Join the Conversation

1 Comment

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.