Is there any way to detect network connection type using javascript?(有没有办法使用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
如何检查连接使用 HTML5/JavaScript 输入(WiFi/LAN/WWAN)?
还有一个可以提供帮助,但仅支持 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检测网络连接类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有办法使用javascript检测网络连接类型?


- 如何显示带有换行符的文本标签? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01