This API is available on Firefox OS for internal applications 仅。

摘要

getNetworks method is used to search for available networks.

句法

var request = navigator.mozMobileConnection.getNetworks();
					

返回

A DOMRequest object to handle the success or failure of the method call.

If the request is successful, the request's result 是数组化的 MozMobileNetworkInfo 对象。

Otherwise, the request's error is one of:

  • RadioNotAvailable
  • RequestNotSupported
  • GenericFailure

范例

var request = navigator.mozMobileConnection.getNetworks();
request.onsuccess = function () {
  this.result.forEach(function (networkInfo) {
    console.log(networkInfo.longName + ': ' + networkInfo.state);
  });
}
request.onerror = function () {
  console.log('operation failed: ' + this.error.name);
}
					

规范

Not part of any specification.

另请参阅

元数据

  • 最后修改: