How do you detect 3G vs. Wifi connection on mobile safari?

前端 未结 3 864
无人共我
无人共我 2021-02-12 18:04

I am specifically asking about javascript on a mobile webpage, not an objective-c application. Is there something like Apple Reachability for javascript so I can tell when Edge,

3条回答
  •  孤城傲影
    2021-02-12 18:24

    At the moment this limitation has improved, but there are still restrictions with the Network Information API supported in the different browsers ( mobile or not ), https://caniuse.com/#search=network

    If this helps you, In our case as our specific mobile application is hybrid and developed using Ionic, we have been able to do it on either iOs or Android using this cordova plugin: https://github.com/apache/cordova-plugin-network-information that works like a charm.

提交回复
热议问题