diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/networkinformation/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/networkinformation/index.html')
-rw-r--r-- | files/zh-cn/web/api/networkinformation/index.html | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/networkinformation/index.html b/files/zh-cn/web/api/networkinformation/index.html new file mode 100644 index 0000000000..a78634c7ed --- /dev/null +++ b/files/zh-cn/web/api/networkinformation/index.html @@ -0,0 +1,134 @@ +--- +title: NetworkInformation +slug: Web/API/NetworkInformation +translation_of: Web/API/NetworkInformation +--- +<div>{{APIRef("Network Information API")}}{{SeeCompatTable}}</div> + +<p><code><strong>NetworkInformation</strong></code> 提供有关设备正在使用的连接与网络进行通信的信息,并提供了在连接类型更改时通知脚本的事件。<code>NetworkInformation</code> 接口不能被是实例化, 而是通过 {{domxref("Navigator")}} 的 <code>connection</code> 属性进行访问。</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="Properties">Properties</h2> + +<p><em>这些属性接口继承自 {{domxref("EventTarget")}}.</em></p> + +<dl> + <dt>{{domxref("NetworkInformation.type")}} {{readonlyinline}}</dt> + <dd>返回设备正在与网络进行通信的连接类型。 它将是以下值之一: + <ul> + <li><code>bluetooth</code></li> + <li><code>cellular</code></li> + <li><code>ethernet</code></li> + <li><code>none</code></li> + <li><code>wifi</code></li> + <li><code>wimax</code></li> + <li><code>other</code></li> + <li><code>unknown</code></li> + </ul> + </dd> + <dt>{{domxref("NetworkInformation.downlinkMax")}} {{readonlyinline}}</dt> + <dd>返回基础连接技术的最大下载速度(Mbps)。</dd> +</dl> + +<h3 id="Event_handlers">Event handlers</h3> + +<dl> + <dt>{{domxref("NetworkInformation.onchange")}}</dt> + <dd>当连接信息更改并在此对象上触发更改时触发的 {{event("change")}} 。</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<p><em>这些属性接口同样继承自 {{domxref("EventTarget")}}.</em></p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Network Information', '#idl-def-NetworkInformation', 'NetworkInformation')}}</td> + <td>{{Spec2('Network Information')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>20 {{property_prefix("webkit")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Android Webview</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoMobile(31)}} {{property_prefix("moz")}}<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + <tr> + <td>Available in workers</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoMobile(53)}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Network_Information_API">Network Information API</a></li> + <li><a href="/en-US/docs/Online_and_offline_events">Online and offline events</a></li> + <li>The {{domxref("Navigator")}} interface that implements it.</li> +</ul> |