JavaScript determines whether or not wifi status

can JavaScript determine the connection mode of the mobile terminal? Just like the uc browser, the video plays automatically in the wifi environment and manually clicks in the non-wifi environment. Can such a function be achieved? How is the UC browser implemented?

Apr.09,2021

navigator.connection.type === 'wifi'

possible values of navigator.connection.type:

bluetooth
cellular
ethernet
none
wifi
wimax
other
unknown

Unfortunately, this is only the draft stage. Currently has no browser implementation .


app can be judged, but the javascript inside the browser does not have this kind of api for the time being

securely, send a packet to the backend to determine whether the source of the request is the base station IP
. In addition, you can also find a way to start with the parameters such as connection speed, delay, etc.


navigator.connection
seems to be allowed

Menu