What’s New in Chrome 89? Exploring Web NFC, WebHID, and Top‑Level Await
This article reviews Chrome 89’s most notable updates—including Top‑level await, Web NFC, WebHID, and the Web Serial API—explaining their technical details, practical demos, and how they expand the web’s ability to interact with hardware and improve developer productivity.
Chrome 89, released on March 2 2021, continues Chrome’s role as a platform that drives web technology forward, moving from a simple browser to a key influencer of web standards.
TL;DR
Release date: 2021‑03‑02
Feature list: 30 new items (see Chrome Platform Status)
Key highlights: Web NFC, WebHID, Web Serial API, Top‑level await, performance.measureUserAgentSpecificMemory()
Detailed Analysis
Top‑level await
Top‑level await allows the await keyword to be used directly in ES modules without wrapping code in an async function, simplifying patterns such as database connection initialization.
<!DOCTYPE html>
<head>
<title>Top-level await</title>
</head>
<body>
<script type="module">
await Promise.resolve(alert('hello, world!'));
</script>
</body>It is only supported in ES modules and can affect module loading order because a module that uses top‑level await blocks its parent and sibling modules until the promise resolves.
Web NFC
Web NFC brings Near Field Communication to the web, enabling use cases such as mobile payments and access control directly from web pages. Chrome 89 on Android enables Web NFC by default, allowing developers to read NFC tags without native code.
Example demo: a phone placed near a card changes the UI color based on the card’s data.
WebHID
WebHID provides a standardized way for web applications to communicate with Human Interface Devices such as game controllers, keyboards, and custom hardware. This opens possibilities for richer web‑based gaming experiences and hardware interaction without native plugins.
Demo: using a PlayStation or Switch Joy‑Con to control Chrome’s dinosaur game.
Web Serial API
The Web Serial API enables web pages to communicate with serial devices (e.g., microcontrollers) over USB or Bluetooth. A common demo uses a BBC micro:bit to display a heart shape via serial communication.
Example Egg.js server that sets the required cross‑origin headers to enable the API:
'use strict';
const Controller = require('egg').Controller;
class HomeController extends Controller {
async index() {
const { ctx } = this;
ctx.set('Cross-Origin-Embedder-Policy', 'require-corp');
ctx.set('Cross-Origin-Opener-Policy', 'same-origin');
ctx.body = 'hi, egg';
}
}
module.exports = HomeController;To actually call performance.measureUserAgentSpecificMemory(), the page must be cross‑origin isolated, which the above headers provide.
await performance.measureUserAgentSpecificMemory();The API returns a JSON object describing memory usage, e.g.:
{
"breakdown": [
{"bytes":0,"types":[]},
{"bytes":191222,"types":[]},
{"bytes":786305,"types":["Shared"]}
],
"bytes":977527
}Summary
Chrome 89’s standout features—Web NFC, WebHID, and Web Serial API—extend the web’s capability to interact directly with hardware, positioning JavaScript as a first‑class language for the Internet of Things. While the demos are still early, they hint at a future where web apps can replace many native solutions across payment, access control, gaming, and education.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
