Network Information API - Web APIs | MDN Skip to main content Skip to search MDN HTML HTML: Markup language HTML reference Elements Global attributes Attributes See all… HTML guides Responsive images HTML cheatsheet Date & time formats See all… Markup languages SVG MathML XML CSS CSS: Styling language CSS reference Properties Selectors At-rules Values See all… CSS guides Box model Animations Flexbox Colors See all… Layout cookbook Column layouts Centering an element Card component See all… JavaScriptJS JavaScript: Scripting language JS reference Standard built-in objects Expressions & operators Statements & declarations Functions See all… JS guides Control flow & error handing Loops and iteration Working with objects Using classes See all… Web APIs Web APIs: Programming interfaces Web API reference File system API Fetch API Geolocation API HTML DOM API Push API Service worker API See all… Web API guides Using the Web animation API Using the Fetch API Working with the History API Using the Web speech API Using web workers All All web technology Technologies Accessibility HTTP URI Web extensions WebAssembly WebDriver See all… Topics Media Performance Privacy Security Progressive web apps Learn Learn web development Frontend developer course Getting started modules Core modules MDN Curriculum Check out the video course from Scrimba, our partner Learn HTML Structuring content with HTML module Learn CSS CSS styling basics module CSS layout module Learn JavaScript Dynamic scripting with JavaScript module Tools Discover our tools Playground HTTP Observatory Border-image generator Border-radius generator Box-shadow generator Color format converter Color mixer Shape generator About Get to know MDN better About MDN Advertise with us Community MDN on GitHub Blog Toggle sidebar Web Web APIs Network Information API Theme OS default Light Dark English (US) Remember language Learn more Deutsch English (US) Español Français 日本語 한국어 Português (do Brasil) Русский 中文 (简体) 正體中文 (繁體) Network Information API Limited availability This feature is not Baseline because it does not work in some of the most widely-used browsers. Learn more See full compatibility Note: This feature is available in Web Workers. The Network Information API provides information about the system's connection in terms of general connection type (e.g., 'wifi, 'cellular', etc.). This can be used to select high definition content or low definition content based on the user's connection. The interface consists of a single NetworkInformation object, an instance of which is returned by the Navigator.connection property or the WorkerNavigator.connection property. In this article Interfaces Examples Specifications Browser compatibility See also Interfaces NetworkInformation Provides information about the connection a device is using to communicate with the network and provides a means for scripts to be notified if the connection type changes. The NetworkInformation interface cannot be instantiated. It is instead accessed through the Navigator interface or the WorkerNavigator interface. Extensions to other interfaces Navigator.connection Read only Returns a NetworkInformation object containing information about the network connection of a device. WorkerNavigator.connection Read only Provides a NetworkInformation object containing information about the network connection of a device. Examples Detect connection changes This example watches for changes to the user's connection. js let type = navigator.connection.effectiveType; function updateConnectionStatus() { console.log( `Connection type changed from ${type} to ${navigator.connection.effectiveType}`, ); type = navigator.connection.effectiveType; } navigator.connection.addEventListener("change", updateConnectionStatus); Preload large resources The connection object is useful for deciding whether to preload resources that take large amounts of bandwidth or memory. This example would be called soon after page load to check for a connection type where preloading a video may not be desirable. If a cellular connection is found, then the preloadVideo flag is set to false. For simplicity and clarity, this example only tests for one connection type. A real-world use case would likely use a switch statement or some other method to check all of the possible values of NetworkInformation.type. Regardless of the type value you can get an estimate of connection speed through the NetworkInformation.effectiveType property. js let preloadVideo = true; const connection = navigator.connection; if (connection) { if (connection.effectiveType === "slow-2g") { preloadVideo = false; } } Specifications Specification Network Information API Browser compatibility Enable JavaScript to view this browser compatibility table. See also Online and offline events Help improve MDN Was this page helpful to you? Yes No Learn how to contribute This page was last modified on Apr 13, 2025 by MDN contributors. View this page on GitHub • Report a problem with this content Filter sidebar Clear filter input Network Information API Interfaces NetworkInformation Properties Navigator.connection WorkerNavigator.connection MDN Your blueprint for a better internet. MDN About Blog Mozilla careers Advertise with us MDN Plus Product help Contribute MDN Community Community resources Writing guidelines MDN Discord MDN on GitHub Developers Web technologies Learn web development Guides Tutorials Glossary Hacks blog Mozilla Website Privacy Notice Telemetry Settings Legal Community Participation Guidelines Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.