This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Web Workers.
The change event of the NetworkInformation interface fires when connection information changes, and the event is received by the NetworkInformation object.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("change", (event) => { })
onchange = (event) => { }
A generic Event.
// Get the connection type.
const type = navigator.connection.type;
function changeHandler(e) {
// Handle change of connection type here.
}
// Register for event changes:
navigator.connection.onchange = changeHandler;
// Another way: navigator.connection.addEventListener('change', changeHandler);
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
change_event |
61 | 79 | No | 48 | No | 38 | NoOn Firefox, the event handler property corresponding to thechange event is ontypechange. |
45 | No | 3.0 | 50 | 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/NetworkInformation/change_event