Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if browser is using mobile data or wifi?

I suspect the answer is no, but I thought I would ask anyway. Is there a way to detect if a browser on a mobile device (for example Chrome on Android) is using WiFi or cell data to connect to the internet?

like image 206
aherriot Avatar asked Aug 12 '16 13:08

aherriot


Video Answer


2 Answers

There's an API for that but it's not widely supported :

navigator.connection.addEventListener('typechange', function(){
   console.log(navigator.connection.type);
});
like image 187
krampstudio Avatar answered Oct 02 '22 22:10

krampstudio


https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API

But remember that this is experimental for now.

Hope this helps.

like image 45
Mykola Borysyuk Avatar answered Oct 02 '22 21:10

Mykola Borysyuk