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 connect event of the SerialPort interface is fired when the port connects to the device.
More specifically, the connect event fires when the port becomes logically connected to the device after a user grants permission for a site to access the port following a Serial.requestPort() call:
This event bubbles to the instance of Serial that returned this interface. The event.target property refers to the SerialPort object that bubbles up.
For more information, see Event bubbling.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("connect", (event) => { })
onconnect = (event) => { }
A generic Event.
The Serial.requestPort() method returns a Promise that resolves with a SerialPort chosen by the user.
// Prompt user to choose a serial port
const port = await navigator.serial.requestPort();
port.addEventListener("connect", (event) => {
// notify that the chosen port is connected
});
The connect event bubbles up to the Serial object where you can listen for any newly-connected ports.
navigator.serial.addEventListener("connect", (event) => {
// notify that a new port is available
// use `event.target` to refer to the newly-added port
});
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
connect_event |
89 | 89 | No | 75 | No | No | No | No | No | No | No | No |
bluetooth_rfcomm |
130 | 130 | No | 115 | No | No | No | No | No | No | No | No |
disconnect event
© 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/connect_event