Is there any way to detect network connection type using javascript? [duplicate]

徘徊边缘 提交于 2019-12-04 03:42:42

问题


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.


回答1:


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?

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



来源:https://stackoverflow.com/questions/30252403/is-there-any-way-to-detect-network-connection-type-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!