This feature is not Baseline because it does not work in some of the most widely-used browsers.
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.
Note: This feature is available in Dedicated Web Workers.
The getInfo() method of the SerialPort interface returns an object containing identifying information for the device available via the port.
getInfo()
None.
An object containing the following properties:
usbVendorIdIf the port is part of a USB device, this property is an unsigned short integer that identifies the device's vendor. If not, it is undefined.
usbProductIdIf the port is part of a USB device, this property is an unsigned short integer that identifies the USB device. If not, it is undefined.
bluetoothServiceClassId Experimental If the port is a Bluetooth RFCOMM service, this property is an unsigned long integer or string representing the device's Bluetooth service class ID. If not, it is undefined.
This snippet calls the Serial.requestPort() method when a <button> is pressed. We pass a filter to requestPort() to filter for Arduino Uno USB devices. Once a port is requested, we call getInfo() to return the device's usbProductId and usbVendorId.
<button id="connect">Connect</button>
const connectBtn = document.getElementById("connect");
// Filter for devices with the Arduino Uno USB Vendor/Product IDs
const filters = [
{ usbVendorId: 0x2341, usbProductId: 0x0043 },
{ usbVendorId: 0x2341, usbProductId: 0x0001 }
];
connectBtn.addEventListener("click", () => {
try {
// Prompt the user to select an Arduino Uno device
const port = await navigator.serial.requestPort({ filters });
// Return the device's identifying info
const { usbProductId, usbVendorId } = port.getInfo();
} catch (e) {
// The user didn't select a device
}
});
| Specification |
|---|
| Web Serial API> # dom-serialport-getinfo> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
getInfo |
89 | 89 | No | 75 | No | No | No | No | No | No | No | No |
bluetoothServiceClassId |
117 | 117 | No | 103 | No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SerialPort/getInfo