← Back to release summary

USBDevice forget()

Category
Device
Type
Chromium catches up
Status
Enabled by default (Chrome 101)
Intent stage
Shipped

Summary

Following the recent HIDDevice forget() addition[1] to the web platform, the USBDevice forget() method allows web developers to voluntarily revoke a permission to a USBDevice that was granted by a user. [1] https://groups.google.com/a/chromium.org/g/blink-dev/c/Fk-IJF63UWc

Motivation

Some sites may not be interested in retaining long-term permissions to access a USB device. For example, for an educational web application used on a shared computer with many devices, a large number of accumulated user-generated permissions creates a poor user experience. In addition to user agent mitigations to avoid this problem, such as defaulting to a session scoped permission on the first request or expiring infrequently used permissions, it should be possible for the site itself to clean up user-generated permissions it is no longer interested in retaining. // Request a USB device. const device = await navigator.usb.requestDevice({ filters: [] }); // Then later... revoke permission to the USB device. await device.forget(); We expect similar functionality to Web Bluetooth and the Serial API to be added.

Standards & signals

Docs: https://web.dev/usb/#revoke-access

Explainers: N/A

View on chromestatus.com