Extending the Reach of the Web to Bluetooth Devices

Posted on May 01, 2017 by Martin Woolley

There's this new thing called the World Wide Web

Do you remember life before the internet? Or more to the point, before the World Wide Web (WWW)? No? OK. But you do remember life before Facebook, right? No?

Oh dear.

You're clearly just trying to make me feel old. And succeeding. Well thank you very much!

Because some of us, myself included, do indeed remember life before the WWW. Just about.

A long time ago in a galaxy actually not very far away at all....

The WWW was born. And for a good while, only the geekiest of geeky types knew about it. I'm talking about people who owned modems and knew what a baud rate was. You know the type......

In those much simpler times, very basic information encoded in a mark-up language called HTML, could be downloaded from a remote computer, over a big network called the internet, to your own computer where, a new-fangled piece of software called a “browser” would present the page in a suitable format for you to read. There was text. There were links you could click on to download and view other pages. There were even pictures sometimes, although the presence of an image would generally mean the page would take a good 10 to 20 minutes to download via your precious modem and rack up an even bigger phone bill in the process. Good times.

I remember well the truly mystified looks on the faces of friends and family when I tried to explain what this “web thing” was and why it was important. It's very possible I babbled.

I now pride myself in the cool and restrained way in which I only make smug, “told you so” comments once or twice... no more than say, three times, whenever my friends mention Facebook or Google. Or cat videos.

Paradigm Shift

I've always wanted to use “paradigm shift” in an article. It was a phrase coined by the philosopher T.S. Kuhn, in his book The Structure of Scientific Revolutions. Not a lot of people know that.

It didn't take long before those same geeks figured out that the same mechanism could be used to dynamically deliver executable code to a computer across the internet, where it would run within the browser. This got some people very excited! It also got others very, very worried! Either way, it was a step change in the way the potential of the WWW was being thought about and some might suggest, a veritable paradigm shift.

John Gage of Sun Microsystems and proponent of the new (at the time), Java programming language, even coined the phrase “The Network is the Computer” to reflect this brave new world of network-centric computing.

The Browser, The Physical Web and Internet of Things

Wind the clock forward to the present day, and the modern web browser is highly sophisticated piece of software, a force to be reckoned with, capable of handling all manner of multimedia content (e.g. HD quality cat videos) and executing code created with a variety of technologies.

Meanwhile, the internet of things (IoT) is upon us and the worlds of the web, of physical things, and IoT are beginning to merge. Google in particular are working hard to progress this “coming together” and mention must be made in passing of their Physical Web project, which leverages Bluetooth beacon technology using the EddyStone format and aims to let you “walk up and use anything”. 

Web Bluetooth

In 2014, Jeffrey Yasskin and Vincent Scheib of Google created the first design document for a new JavaScript API which would allow code executing in a web browser to discover, connect to, and interact with Bluetooth devices. This API is called Web Bluetooth and it has some amazing potential.  Web Bluetooth can conceivably extend the boundary of what we consider to be the world wide web, to include physical devices like wearables, smart home gadgets and industrial systems.

That's the vision, at least. That code can be dynamically delivered to any internet connected computing device and securely executed within a web browser, allowing physical Bluetooth devices to be used without the need to install an application every time you want to use a new type of Bluetooth device. This is “web thinking” applied to the world of physical objects and it will, I have no doubt, in the fullness of time have a substantial impact.

Web Bluetooth is being progressed as a W3C community project, and whilst Google continue to play a leading role, there are other companies involved including Intel, Mozilla, Logitech and more. It all looks very promising.

What does Web Bluetooth look like?

The Web Bluetooth API is well documented and there's a good collection of samples to learn from.

Here's a simple example, taken from an article by Google's François Beaufort.

The requestDevice function scans for Bluetooth devices which have the specified GATT service, in this case, the standard Battery Service. A dialogue is presented by the browser to the user and lists any discovered devices which met the filter criteria.

The user can then select a device from the list and connect to it by clicking the PAIR button. Note that the term “pair” in this dialogue just means “connect to and remember” rather than the usual definition of the term, relating to Bluetooth security.

getPrimaryService returns a representation of the specified GATT service and getCharacteristic, not surprisingly, provides an object which represents a GATT characteristic, contained within the service. It's then possible to invoke read and write operations on the characteristic.

Anyone with basic knowledge of Bluetooth GATT should find it very easy to learn Web Bluetooth.


The Web Bluetooth team take the topic of security very seriously. Various safeguards have been designed into the specification to help address identified security issues, such as only allowing the API to be used when the code has been downloaded from a trusted server over HTTPS. You can read an honest appraisal of the security challenges and the way the Web Bluetooth security model attempts to address them, by Jeffrey Yasskin for more information on this topic.

What's its current status?

At the time of writing, Web Bluetooth is not a W3C standard and has not yet been passed through a formal, W3C working group. You can check its implementation status across browser types and platforms here.

Currently, Web Bluetooth is implemented in Chrome for Android version 6 onwards, macOS (Yosemite or later) and Linux (for developers only, at this stage). There’s early stage support for a small subset of the API in Chrome for Windows. The Opera browser has similar support to Chrome.

Firefox, Microsoft Edge and Safari do not yet support Web Bluetooth.

In environments, such as the enterprise, where control over the type of browser which is installed by users may exist, Web Bluetooth already has great potential. For the general population of web users on Planet Earth, there's still some way to go before the browser places the power to interact with Bluetooth devices into the hands of the masses.

What about hybrid mobile applications?

I recently wrote about hybrid mobile application development, here in the Bluetooth SIG blog. See Part 1 and Part 2. This is an approach to creating installable, native applications for multiple platforms (e.g. Android and iOS) from a single set of source code. The developer works with HTML, CSS and JavaScript and uses “plug-in” APIs to access platform native features, including Bluetooth. The SDK takes that code and generates a native application which leverages a component called a WebView to render and execute the web content on the target native platform.

Currently, the Web Bluetooth APIs are not available for the Chrome WebView component and so hybrid mobile developers must, for now, continue to use 3rd party plug-in APIs for Bluetooth access. The Web Bluetooth team have stated that they plan to support Chrome's WebView in the future, at which point, hybrid mobile developers may be able to move away from using proprietary 3rd party APIs to Web Bluetooth.  By this time, Web Bluetooth  may well be a fully adopted W3C standard.

The Future of Web Bluetooth

Web Bluetooth has reached a remarkable level of maturity and is implemented in a significant percentage of the browsers installed on desktop and mobile devices. It has been developed in a W3C community group and to move to full W3C Recommendation status will still need to move through a W3C working group.

If Web Bluetooth can achieve the status of W3C Recommendation, this will be a very significant milestone in the evolution of this important IoT and web technology. It will then be up to companies such as Apple, Mozilla and Microsoft to implement the API in their browsers. When that happens, the web's boundaries will have been significantly extended to encompass the billions of Bluetooth devices that ship every year. I look forward to seeing Web Bluetooth continue to make great progress and to the day I can walk up to any computer with a browser and use it to control my Bluetooth devices.

martin woolley

Martin Woolley

Martin is on the Bluetooth Developer Programs and Evangelism team. He specializes in mobile applications and technology, with over 30 years of experience in software development.

View all posts by Martin Woolley