/Web APIs


Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The USBConnectionEvent interface of the WebUSB API is the event type passed to USB connect and disconnect events when the user agent detects that a new USB device has been connected or disconnected.

Event USBConnectionEvent


USBConnectionEvent() Experimental

Returns a USBConnectionEvent object.

Instance properties

USBConnectionEvent.device Read only Experimental

Returns a USBDevice object representing the current device.


In the following example listening for connect and disconnect events is used to add and remove the devices from the user interface of an application.


navigator.usb.addEventListener("connect", (event) => {
  // Add event.device to the UI.

navigator.usb.addEventListener("disconnect", (event) => {
  // Remove event.device from the UI.


Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
USBConnectionEvent 61 79 No No 48 No No 61 No 45 No 8.0
USBConnectionEvent 61 79 No No 48 No
NoWebView exposes this interface, but does not support WebUSB. See Chromium bug 933055.
61 No 45 No 8.0
device 61 79 No No 48 No No 61 No 45 No 8.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.