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/navigator/connection | |
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/navigator/connection')
-rw-r--r-- | files/zh-cn/web/api/navigator/connection/index.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/navigator/connection/index.html b/files/zh-cn/web/api/navigator/connection/index.html new file mode 100644 index 0000000000..23e3aaa29b --- /dev/null +++ b/files/zh-cn/web/api/navigator/connection/index.html @@ -0,0 +1,45 @@ +--- +title: Navigator.connection +slug: Web/API/Navigator/connection +translation_of: Web/API/Navigator/connection +--- +<div>{{APIRef("Network Information API")}}{{SeeCompatTable}}</div> + +<p><code><strong>Navigator.connection</strong></code> 是只读的,提供一个{{domxref("NetworkInformation")}} 对象来获取设备的网络连接信息。例如用户设备的当前带宽或连接是否被计量, 这可以用于基于用户的连接来选择高清晰度内容或低清晰度内容。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>connectionInfo</em> = navigator.connection</pre> + +<h3 id="值">值</h3> + +<p>返回网络连接状态NetworkInformation对象,包括.downlink(网络下行速度) effectiveType(网络类型) onchange(有值代表网络状态变更) rtt(估算的往返时间) saveData(打开/请求数据保护模式)</p> + +<h2 id="标准">标准</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">标准</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Network Information', '#h-the-connection-attribute', 'Navigator.connection')}}</td> + <td>{{Spec2('Network Information')}}</td> + <td>初次定义</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容情况">浏览器兼容情况</h2> + +<p>{{Compat("api.Navigator.connection")}}</p> + +<h2 id="参考资料">参考资料</h2> + +<ul> + <li><a href="/en-US/docs/Online_and_offline_events">Online and offline events</a></li> +</ul> |