navigator.onLine reports correctly in most cases, but I found this to be wrong if you have to turn off Wi-Fi, but you have an Ethernet PoE cable connected to your NIC port. Despite the fact that the phone can be offline, navigator.onLine reports that the browser is actually on the network.
source share