有什么方法来检测网络连接类型使用javascript? [英] Is there any way to detect network connection type using javascript?
问题描述
我想知道是否有任何方法来检查用户是否使用javascript从2G,3G,4G或WiFi连接。据我所知,只有Mozilla提供了一个网络信息API,它有助于检测一般的连接类型,如wifi,蜂窝等。
I would like to know is there any way to check if user is connected from 2G, 3G, 4G, or WiFi using javascript. As of my knowledge only Mozilla provides a Network Information API which helps to detect general connection type like 'wifi', 'cellular' etc.
推荐答案
将网络暴露给javascript是一种错误的方法。无论如何,为了您的更好的了解,请通过以下链接
It is a wrong approach to expose your network to javascript. Anyways for your better understanding please go through the below link
How do I check connection type (WiFi/LAN/WWAN) using HTML5/JavaScript?
有一个可以帮助,但只支持mozilla和信息,你可以访问以下链接
And there is one that can be of help but only supports mozilla and for the info you can visit the below link
https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API
这篇关于有什么方法来检测网络连接类型使用javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!