From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../zh-cn/web/api/navigator/connection/index.html | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 files/zh-cn/web/api/navigator/connection/index.html (limited to 'files/zh-cn/web/api/navigator/connection') 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 +--- +
{{APIRef("Network Information API")}}{{SeeCompatTable}}
+ +

Navigator.connection 是只读的,提供一个{{domxref("NetworkInformation")}} 对象来获取设备的网络连接信息。例如用户设备的当前带宽或连接是否被计量, 这可以用于基于用户的连接来选择高清晰度内容或低清晰度内容。

+ +

语法

+ +
connectionInfo = navigator.connection
+ +

+ +

返回网络连接状态NetworkInformation对象,包括.downlink(网络下行速度)  effectiveType(网络类型) onchange(有值代表网络状态变更) rtt(估算的往返时间) saveData(打开/请求数据保护模式)

+ +

标准

+ + + + + + + + + + + + + + + + +
标准状态备注
{{SpecName('Network Information', '#h-the-connection-attribute', 'Navigator.connection')}}{{Spec2('Network Information')}}初次定义
+ +

浏览器兼容情况

+ +

{{Compat("api.Navigator.connection")}}

+ +

参考资料

+ + -- cgit v1.2.3-54-g00ecf