coderef

Network InformationLimited availability

The navigator.connection API provides information about the network connection a device is using and fires events when the connection type changes.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
✕Not supportedup to 155
Current: 155
Edge
✕Not supportedup to 154
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–66Not supported
67+Supportedsince May 31, 2018
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Chrome, Edge, Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: connection.

Feature detection

JS · check before using
if ("NetworkInformation" in globalThis) {
  // NetworkInformation is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (13). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Navigator.connection6179✕✕38✕✕
NetworkInformation6179✕✕38✕✕
NetworkInformation.change_event6179✕✕38✕✕
NetworkInformation.downlink6179✕✕38✕✕
NetworkInformation.downlinkMax✕✕✕✕38✕✕
NetworkInformation.effectiveType6179✕✕38✕✕
NetworkInformation.rtt6179✕✕38✕✕
NetworkInformation.type✕✕✕✕38✕✕
NetworkInformation.worker_support6179✕✕38✕✕
WorkerNavigator.connection6179✕✕38✕✕
http.headers.Downlink6779✕✕67✕✕
http.headers.ECT6779✕✕67✕✕
http.headers.RTT6779✕✕67✕✕