The Wayback Machine - https://web.archive.org/web/20150927070648/https://developer.mozilla.org/ja/docs/Web/API/Connection

Join MDN and developers like you at Mozilla's View Source conference, November 2-4 in Portland, Oregon. Learn more at https://viewsourceconf.org/.

Connection

by 4 contributors:
この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

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 Connection interface represents the connectivity of the device on which the browser runs.

An object of this type can be obtained via connection property, available on the Navigator object:

var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;

Properties

The Connection interface inherits properties from its parent, the EventTarget interface.

Connection.bandwidth Read only
Is a double representing the estimated download bandwidth (in MB/s) of the current connection. 0 if the user is currently offline and infinity if the bandwidth is unknown.
Connection.metered Read only
Is a Boolean flag indicating if the connection is metered (e.g., pay-per-use).

Events handler

Connection.onchange
Is an EventHandler  for the change event. This event is fired when the connection information changes.

Methods

The Connection interface doesn't implement any specific method, but inherits methods from its parent, the EventTarget interface.

Specifications

Specification Status Comment
Network Information API
The definition of 'Connection' in that specification.
Editor's Draft Initial specification.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported 12.0 moz Not supported Not supported Not supported
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported 12.0 moz Not supported Not supported Not supported

Gecko notes

  • The Network API can be disabled using the dom.network.enabled preference.
  • 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.
  • Before Gecko 14.0, navigator.mozConnection was not an instance of EventTarget, meaning that you couldn't use addEventListener() could be called. This has been fixed.

See also

ドキュメントのタグと貢献者

Contributors to this page: fscholz, JonathanMM, teoli, Nickolay
最終更新者: fscholz,