Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NetworkInformation.ontypechange

이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The NetworkInformation.ontypechange event handler is a property containing the code to execute when the typechange event, of type Event, is received by this NetworkInformation instance. That event is sent by the browser to let content know that the value of the NetworkInformation.type attribute has changed.

This was present in early versions of the specification and has been replaced by the NetworkInformation.onchange event handler. Implementations have not yet all switched to the new standard event.

Syntax

networkinformation.ontypechange = function;

Values

  • function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}.  An event handler always has a single parameter: an event object, of type Event in this case.

Example

// Get the connection type.
var type = navigator.connection.type;

function changeHandler(e) {
  // Handle change of connection type here.
}

// Register for event changes:
navigator.connection.ontypechange = changeHandler;

// Another way:
navigator.connection.addEventListener('typechange', changeHandler);

Specifications

Although present in some drafts, this is not part of any standard.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported 31 (31) Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Firefox OS
Basic support Not supported 38 31.0 (31) ? ? ? 2.0

See also

문서 태그 및 공헌자

 이 페이지의 공헌자: teoli, Jeremie, fscholz, gskachkov, Sheppy, Biraj
 최종 변경: teoli,