navigator.connection returns a NetworkInformation object — hints about bandwidth and connection quality. Learn effectiveType, downlink, rtt, saveData, change events, five examples, and try-it labs.
01
Kind
Read-only property
02
Returns
NetworkInformation
03
Status
Experimental
04
Quality
effectiveType
05
Speed
downlink / rtt
06
Data saver
saveData
Fundamentals
Introduction
Not every visitor has a fast, unlimited network. Some are on slow mobile data, some have “Data Saver” turned on, and some switch between Wi‑Fi and cellular.
The Network Information API exposes those hints through navigator.connection. You can use them to pick HD vs SD video, smaller images, or fewer background syncs — when the browser supports the API.
💡
Hints, not guarantees
Values are estimates. Always keep a solid default experience for browsers without navigator.connection (common in Safari and Firefox).
Concept
Understanding the connection Property
Think of navigator.connection as a read-only dashboard for the current network. You do not assign to it — you read properties on the object it returns.
effectiveType — coarse quality: slow-2g, 2g, 3g, or 4g.
downlink — estimated bandwidth in Mbps.
rtt — estimated round-trip time in milliseconds.
saveData — true when reduced data usage is requested.
type — connection kind (for example wifi, cellular) where supported.
change event — fires when connection information updates.
Foundation
📝 Syntax
General form of the property:
JavaScript
navigator.connection
Value
A NetworkInformation object describing the system connection (or undefined if unsupported).
Four facts to remember about navigator.connection.
Returns
NetworkInformation
API object
Status
experimental
Not Baseline
Key field
effectiveType
Quality hint
Best use
adaptive
Optional upgrade
Compare
📋 connection vs Online Events
navigator.connection
online / offline
Answers
How fast / metered?
Are we online at all?
Detail
effectiveType, downlink, rtt
Boolean connectivity
Support
Limited / experimental
Widely available
Best for
Adaptive media quality
Queue sync / retry
Use together?
Yes — online status for reachability; connection for quality when present
Hands-On
Examples Gallery
Examples follow MDN Network Information / navigator.connection patterns. Prefer Try It Yourself to inspect your own browser. Use View Output for expected messaging.
quality: high
(or medium / low depending on hints)
How It Works
Default to high quality when the API is missing so Safari/Firefox users are not punished.
Example 5 — Listen for change
Update UI when the connection information changes.
JavaScript
const conn = navigator.connection;
const out = [];
function report(label) {
if (!conn) {
out.push(label + ": unsupported");
return;
}
out.push(label + ": " + conn.effectiveType);
}
report("initial");
if (conn) {
conn.addEventListener("change", function () {
report("changed");
console.log(out.join("\n"));
});
}
console.log(out.join("\n"));
// Toggle network / Data Saver in DevTools to see "changed" in Try It
navigator.connection (Network Information API) is Experimental and not Baseline. Chromium-based browsers lead support; Safari and Firefox typically do not expose it. Always feature-detect and keep a default experience.
✓ Experimental · Not Baseline
Navigator.connection
Use effectiveType / saveData as optional hints for adaptive loading — never as a hard requirement.
LimitedNot Baseline
Google ChromeNetwork Information (effectiveType and related) supported
Supported
Microsoft EdgeChromium Edge — follows Chrome Network Information support
Supported
OperaChromium-based — Network Information generally available
Supported
Mozilla FirefoxNot available for typical web content
Unavailable
Apple SafariNot available (desktop / iOS)
Unavailable
connectionLimited
Bottom line: Detect navigator.connection, adapt when present, and ship a solid default for unsupported browsers.
Wrap Up
Conclusion
navigator.connection is the Network Information API entry point. Feature-detect it, read effectiveType / saveData as hints, adapt media when helpful, and keep a strong default for browsers without the API.
Network hints for adaptive loading — experimental and optional.
5
Core concepts
📡01
Returns
NetworkInformation
API
📶02
Quality
effectiveType
Hint
⚡03
Speed
downlink / rtt
Estimate
💾04
Data saver
saveData
Respect
🔬05
Status
Experimental
Detect
❓ Frequently Asked Questions
It is a read-only Navigator property that returns a NetworkInformation object with details about the device’s network connection — for example effectiveType, downlink, rtt, and saveData.
Yes. The Network Information API is experimental / not Baseline. Support is strongest in Chromium-based browsers; Safari and Firefox typically do not expose it. Always feature-detect.
A coarse connection quality label such as "slow-2g", "2g", "3g", or "4g". Use it as a hint for adaptive loading (for example lower image quality on slow-2g or 2g).
downlink is an estimate of bandwidth in megabits per second. rtt is an estimate of round-trip time in milliseconds. Values are approximate and can change.
A boolean that is true when the user (or browser) has requested reduced data usage. Prefer lighter assets when saveData is true.
No. The property is read-only. You read fields on the NetworkInformation object and can listen for its change event.
Did you know?
MDN’s classic use case for navigator.connection is choosing high-definition vs low-definition content from the user’s connection — still the best mental model for beginners.