I have a situation where the user has a Wi-Fi connection, but the Wi-Fi is not connected to the Internet.
So navigator.onLine produces a true, but in reality the user is not online. Short of doing an actual ajax call, is there another indicator to tell whether we’re online or not?
I seem to remember that PhoneGap had an extra indicator.
Something like this should work
var req = new XMLHttpRequest();
req.open('GET', 'http://www.google.com', false);
req.send(null);
if(req.status == 200)
alert(req.responseText);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With