This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
The NetworkInformation
interface provides information about the connection a device is using to commuinicate with the network and provides a means for scripts to be notified if the connection type changes. The NetworkInformation
interfaces cannot be instantiated. It is instead accessed through the connection
property of the Navigator
interface.
Properties
This interface also inherits properties of its parent, EventTarget
.
NetworkInformation.type
Read only- Returns the type of connection a device is using to communicate with the network. It will be one of the following values:
bluethooth
cellular
ethernet
none
wifi
wimax
other
unknown
NetworkInformation.downlinkMax
Read only- Returns the maximum downlink speed, in megabits per second (Mbps), for the underlying connection technology.
Event handlers
NetworkInformation.onchange
- The event that's fired when connection information changes and the
change
is fired on this object.
Methods
This interface also inherits methods of its parent, EventTarget
.
Specifications
Specification | Status | Comment |
---|---|---|
Network Information API The definition of 'NetworkInformation' in that specification. |
Editor's Draft | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 20 webkit | 31.0 moz[1] | Not supported | Not supported | Not supported |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | Not supported | Not supported | 31.0 moz[1] | Not supported | Not supported | Not supported | Not supported |
[1] The Network API can be disabled using the dom.network.enabled
preference. From Gecko 12.0 to Gecko 30.0 included, this interface was called Connection
and had different members. As of Gecko 12.0, the Network API is implemented for Android systems only. Support for Linux (bug 712442) and Windows (bug 721306) systems is in progress.
See also
- Network Information API
- Online and offline events
- The
Navigator
interface that implements it.