The change
event fires when connection information changes, and the event is received by the NetworkInformation
object.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("change", (event) => {});
onchange = (event) => {};
Event type
Examples
const type = navigator.connection.type;
function changeHandler(e) {
}
navigator.connection.onchange = changeHandler;
Specifications
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 |
change_event |
61 |
79 |
No |
No |
48 |
No |
50 |
38 |
NoOn Firefox, the event handler property corresponding to the change event is ontypechange .
|
45 |
No |
3.0 |