Skip to content

WebUSB explained: browser support, safe access and real projects

BROWSER APIs · HARDWARE · PRACTICAL GUIDE

A USB cable is only the beginning

WebUSB can give a web app direct access to a compatible USB interface. The useful question is: does this browser, this device and this application support the same workflow?

A student can send a MakeCode project to a supported micro:bit from the browser. A hardware maker can build a web-based configuration tool. WebUSB makes those kinds of experiences possible, but it does not make every USB peripheral accessible or every firmware download trustworthy. MakeCode’s WebUSB guide shows a real, device-specific example.

The WebUSB workflow: four checks before data moves
  1. 1 · Check
    Secure page, supported browser and compatible interface.
  2. 2 · Choose
    A user action opens the browser’s device chooser.
  3. 3 · Communicate
    The app opens and claims the documented interface, then uses its protocol.
  4. 4 · Finish
    Close the session; offer a separate way to forget permission.

What WebUSB actually connects

A USB device can expose several interfaces, each serving a different function. WebUSB is useful for a vendor-specific interface whose protocol the application understands. Another interface on the same device may remain under an operating-system driver’s control. For example, a keyboard can keep its ordinary input interface while offering a separate configuration interface. Interface design and driver ownership.

An optional WebUSB descriptor can advertise a landing-page URL. It is a discovery hint, not automatic permission, proof of trust or a requirement for every accessible device. Notification behavior varies by platform; do not build an onboarding flow that depends on a popup appearing. WebUSB descriptor overview; Arduino WebUSB platform notes.

Browser support: check the actual environment

As checked on , WebUSB has limited browser availability. “Supported” means the API is implemented, not that every board, driver or transfer works. MDN WebUSB overview; maintained browser-compatibility data.

WebUSB availability and practical limits
Browser or environmentWhat to expect
Chrome on desktop and AndroidImplemented; Chrome first shipped the API in version 61. Device access still depends on platform, permissions and hardware.
Chromium-based Edge on desktopImplemented. Use an up-to-date release and verify the exact device workflow; this is not a promise about every Edge platform.
Firefox and SafariWebUSB is not implemented in the compatibility data checked for this revision.
Embedded browsers and mobile appsDo not infer support from a browser brand. Android WebView is listed as unsupported even though it can expose the interface.

Serve a production application over HTTPS. Localhost can qualify as a secure context for development; an ordinary HTTP site does not. Use window.isSecureContext and feature detection, then handle failures. A positive feature check is only a first gate. Secure-context rules.

Permission is specific, and access has limits

  • requestDevice() needs a recent user action and presents a device chooser. Narrow vendor/product filters help users select the intended model; they do not authenticate it. Device-request reference.
  • getDevices() returns attached devices already paired with the site. It is not an inventory of every USB device and does not grant new permission. Previously paired devices.
  • A page’s usb Permissions Policy can prevent access, including in embedded content. Being on HTTPS alone does not override that policy. Permissions Policy documentation.
  • Ordinary web pages cannot claim protected interface classes such as HID, audio, video, mass storage, hubs, smart cards and wireless controllers. A separate device blocklist also applies. These are interface/device restrictions, not a claim that every function of a composite device is inaccessible. WebUSB specification, sections 6.4 and 7.
  • For FIDO security-key sign-in, use WebAuthn rather than designing an authentication flow around raw USB access.

Keep permission controls visible. close() ends a session; it is not the same as revoking access. forget() resets the permission and ends outstanding device use where supported. A user can also review the site’s USB permissions in their browser. USBDevice.forget() reference.

Start with selection, not a firmware write

This intentionally incomplete developer template shows the chooser only. Place the JavaScript after the two HTML elements in your own test page. Leave the IDs unset until the device’s documentation confirms the supported model and protocol. The code below is displayed as text; this article does not request USB access.

Example 1 · HTML for a device chooser

<button id="choose-usb" type="button">Choose supported device</button>
<p id="usb-status" role="status">No device selected.</p>

Example 2 · JavaScript: request permission without opening a session

// Fill these from the supported device's documentation; do not guess.
const expected = { vendorId: null, productId: null };
const button = document.querySelector("#choose-usb");
const status = document.querySelector("#usb-status");

button.addEventListener("click", async () => {
  if (!window.isSecureContext || !("usb" in navigator)) {
    status.textContent = "WebUSB is unavailable in this context.";
    return;
  }
  const validId = value => Number.isInteger(value)
    && value >= 0 && value <= 0xffff;
  if (!validId(expected.vendorId) || !validId(expected.productId)) {
    status.textContent = "Configure the documented vendor and product IDs first.";
    return;
  }

  button.disabled = true;
  try {
    const device = await navigator.usb.requestDevice({ filters: [expected] });
    status.textContent = device
      ? `Selected ${device.productName || "USB device"}. No session opened.`
      : "No device selected.";
  } catch (error) {
    status.textContent = error.name === "NotFoundError"
      ? "No device selected. You can try again when ready."
      : "Selection was unavailable or blocked. Check browser and site support.";
  } finally {
    button.disabled = false;
  }
});

Selecting a device does grant the site permission. This example does not call open(), claim an interface, send application transfer commands or flash firmware. Use it only on a test page you control, with hardware you are authorized to access. The user-action and filtering behavior is documented in requestDevice().

What comes after selection?

A real integration opens the device, selects the required configuration if needed, claims the documented interface and exchanges messages using the vendor’s protocol. It must check transfer results, handle disconnection, release the interface and close the session. Configuration numbers, endpoint numbers and control-request values are device-specific. The original Arduino-style values are not a universal recipe. Chrome’s illustrative Arduino integration.

An endpoint is a device-side data buffer. IN means device to host; OUT means host to device. A successful USB transfer also does not prove that the application understood the payload. Parse the format the device actually documents. USB endpoints and directions.

The four USB transfer types

Transfer methods describe transport, not universal device access
TypeWebUSB methodsPractical meaning
ControlcontrolTransferIn() / controlTransferOut()Small requests for device information, configuration or protocol-specific control.
BulktransferIn() / transferOut()Reliable data transfer using available bandwidth; latency and throughput are not reserved.
InterrupttransferIn() / transferOut()Periodic endpoint transfers for timely small messages. The endpoint determines the transfer type.
IsochronousisochronousTransferIn() / isochronousTransferOut()Scheduled streaming transfers. Reserved bus time does not guarantee delivery; failed packets are not retried.

See bulk/interrupt API behavior, isochronous API behavior, USB bulk scheduling and isochronous delivery limits. Audio, video and storage are familiar USB examples, but their protected interfaces are not thereby available to an ordinary WebUSB page.

Real projects: look beyond the USB cable

Which projects actually demonstrate WebUSB?
ProjectWhat the documentation establishes
Microsoft MakeCode for micro:bitA verified WebUSB workflow for direct project downloads and console data on supported boards/firmware. Support for one MakeCode target does not establish support for every target.
webusb/arduinoA third-party Arduino library and demos that expose a vendor-specific interface. It lists compatible boards and setup requirements; it is not an official universal Arduino capability.
Arduino Cloud EditorA different workflow: the vendor says Windows, macOS and Linux need Arduino Cloud Agent for physical-board access. Browser-based editing alone does not prove WebUSB use.
Espruino Web IDEThe project describes its web version’s USB/serial connection as Web Serial, alongside Bluetooth and other options. Do not label the whole IDE a WebUSB example.
CircuitPython Code EditorOffers workflows including Web Serial, Bluetooth and a selected device-drive folder. A separate CircuitPython WebUSB vendor console is board/build-dependent; neither means every CircuitPython board supports WebUSB.
devanlai/webdfuA WebUSB firmware-update proof-of-concept. Compatibility and trust require extra care, as below.

A web-based IDE, a USB connection and WebUSB are three different things. Check the project’s current transport and exact board requirements before choosing an integration.

WebDFU: a useful example, not a universal updater

The verified project is devanlai/webdfu. Its author’s project page calls it a proof-of-concept, describes USB DFU 1.1 and DfuSe 1.1a support, and reports an STM32F042xx test. That establishes a specific example, not compatibility with every STM32, ESP32, DFU implementation or firmware image.

Open source, standards and debugging

  • webusb/arduino is useful for studying descriptors and a concrete device protocol. Check its board and platform notes rather than copying setup changes blindly.
  • whatwg/usb is the current specification repository; the former WICG/webusb address redirects there. The published specification identifies itself as a Draft Community Group Report dated 5 June 2026 and explicitly says it is not a W3C Standard or on the W3C Standards Track. A repository move does not establish a different standards status.
  • about://device-log and about://usb-internals are Chrome debugging pages. The latter supports simulated connection/disconnection for UI checks. Such simulations do not validate a physical protocol, firmware update or driver combination. Chrome debugging documentation.

If the device does not connect

  • No API: check the browser, secure context and embedding policy. Offer an honest unsupported-browser message rather than an endlessly disabled Connect button.
  • No device in the chooser: verify the documented vendor/product IDs, board mode and connection. A filtered-out or protected interface cannot be made compatible by granting permission again.
  • Permission granted, open or claim fails: another application or operating-system driver may own the interface. Consult the vendor’s supported setup; do not disable protections or replace drivers just to make a generic sample work.
  • Transfer fails or returns unexpected data: confirm the configuration, interface, endpoint and message format. Report the error and clean up the session instead of repeatedly sending unknown commands.

These are a diagnostic order, not a compatibility test. The device, browser and operating system remain part of the application’s support matrix. Platform and interface requirements.

Correction and original artwork

Updated 27 October 2026. Corrected the WebDFU attribution to devanlai/webdfu, distinguished browser-based tools from actual WebUSB implementations, narrowed the driver and hardware claims, and refreshed the specification link and status. The original publication date and URL are retained. The previous thegecko/webdfu attribution was not verified; this correction does not establish that such a repository never existed.

Original artwork, retained for continuity. Its “No Drivers” slogan is too broad, and “W3C WICG” does not mean W3C-standard status. Use the corrected explanations above.

WebUSB API thumbnail
The original WebUSB illustration accompanies the article’s publication history; it is not a compatibility or standards-status guarantee.
Written by Alex R. | Coding with Alex
Originally published . Tags: WebUSB, Browser APIs, Hardware, Arduino, IoT, Chrome, Edge.

Post a Comment

Previous Post Next Post