这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
NetworkInformation
interface provides information about the connection a device is using to communicate with the network and provides a means for scripts to be notified if the connection type changes. The
NetworkInformation
interfaces cannot be instantiated. It is instead accessed through the
connection
特性为
Navigator
接口。
此接口还继承其父级的特性,
EventTarget
.
NetworkInformation.downlink
只读
Returns the effective bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds.
NetworkInformation.downlinkMax
只读
Returns the maximum downlink speed, in megabits per second (Mbps), for the underlying connection technology.
NetworkInformation.effectiveType
只读
Returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'. This value is determined using a combination of recently observed round-trip time and downlink values.
NetworkInformation.rtt
只读
Returns the estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds.
NetworkInformation.saveData
只读
true
if the user has set a reduced data usage option on the user agent.
NetworkInformation.type
只读
bluetooth
cellular
ethernet
none
wifi
wimax
other
未知
NetworkInformation.onchange
change
is fired on this object.
此接口还继承其父级的方法,
EventTarget
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
网络信息 API
The definition of 'NetworkInformation' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
NetworkInformation
|
Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android 31 | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
downlink
|
Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android ? | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
downlinkMax
|
Chrome
61
|
Edge No | Firefox No | IE No | Opera No | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android No | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
effectiveType
|
Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android Yes | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
onchange
|
Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 |
Firefox Android
No
|
Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
ontypechange
|
Chrome No | Edge No | Firefox No | IE No | Opera ? | Safari No | WebView Android No | Chrome Android No | Firefox Android ? | Opera Android ? | Safari iOS No | Samsung Internet Android No |
rtt
|
Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android No | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
saveData
|
Chrome 65 | Edge 79 | Firefox No | IE No | Opera Yes | Safari No | WebView Android 65 | Chrome Android 65 | Firefox Android ? | Opera Android Yes | Safari iOS No | Samsung Internet Android 9.0 |
type
|
Chrome
61
|
Edge No | Firefox No | IE No | Opera No | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android No | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
| Available in workers | Chrome 61 | Edge 79 | Firefox No | IE No | Opera 48 | Safari No | WebView Android 50 | Chrome Android 38 | Firefox Android 53 | Opera Android 45 | Safari iOS No | Samsung Internet Android 3.0 |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
见实现注意事项。
Navigator
interface that implements it.
NetworkInformation