如何使用HTML5 / JavaScript检查连接类型(WiFi / LAN / WWAN)? [英] How do I check connection type (WiFi/LAN/WWAN) using HTML5/JavaScript?

查看:124
本文介绍了如何使用HTML5 / JavaScript检查连接类型(WiFi / LAN / WWAN)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果客户端通过WWAN(计量)连接或其他方式连接,我希望将特定网站定制为低带宽版本。

连接类型对于该网站了解它是否应提供丰富的体验或带宽高效体验。我的桌面运行在计量连接上,未来将有更多台式计算机通过计量蜂窝网络(包括Windows 8平板电脑)连接,高效的网络应用程序应该尊重用户可能不需要按收费计费的高细节资产,字节连接。

如何使用HTML5 / JavaScript检查客户端是否通过WiFi / LAN / WWAN连接?



注意:我不希望显式检查浏览器标题(这对于可以通过多种方法连接到互联网的桌面浏览器并不是真正的解决方案)。 h2_lin>解决方案

请参阅 navigator.connection (前缀)。该API公开有关客户端带宽的信息。


I wish to tailor a particular website to a low bandwidth version if the client is connected via WWAN (metered) connection or otherwise.

The connection type is important for the site to know if it should provide a rich experience or a bandwidth efficient experience. My desktop runs on a metered connection and in the future, more desktops will be connected via metered cellular networks (including Windows 8 tablet PCs), efficient web-apps should respect that a user might not require high detail assets on a pay-per-byte-connection.

How do I check if the client is connected via WiFi/LAN/WWAN using HTML5/JavaScript?

NOTE : I do not wish to explicitly check for browser headers (which is not really a solution for desktop browsers that can connect to the internet via multiple methods).

解决方案

See navigator.connection (prefixed). This API exposes information about the bandwidth of the client.

这篇关于如何使用HTML5 / JavaScript检查连接类型(WiFi / LAN / WWAN)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆