问题标签 [networkinformation]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
202 浏览

javascript - 为什么 NetworkInformation.effectiveType 给我返回的是 4g 网络而不是 wifi?

我正在使用网络信息 API来获取网络类型。

我正在使用公司的 wifi 网络。我预计effectiveType财产的价值应该是wifi。因为我有一些这样的代码逻辑:

那可能吗?我找到了NetworkInformation.type只读属性,但它给了我undefined. 它不支持边缘。

我看到EffectiveConnectionType 枚举没有wifi价值。

环境:

  • macOS 10.15.7
  • 微软边缘 89.0.774.63
0 投票
0 回答
31 浏览

ios - iOS 公共 API CTTelephonyNetworkInfo 在漫游时返回错误的 MNC

当用户从服务“X”网络运营商 ex:(MCC:123 和 MNC:10) 的区域移动到服务“X”漫游运营商 (MCC:123 和 MNC:20) 的区域时,API CTTelephonyNetworkInfo -> serviceSubscriberCellularProviders -> mobileNetworkCode 在“X”漫游运营商中将 MNC 返回为 10,这是不正确的,而使用哈希码的私有 API 将 MNC 返回为 20。