Assuming there is no internet connection, of course. Like a jQuery method?
I would try to make HEAD requests (no content downloaded) to a few servers you know are online. They will automatically fail if there is no network (no need to set a timeout).
$.ajax({
type: "HEAD",
url: 'http://www.google.com',
error: function() {
alert('world is gone !');
}
});
DEMONSTRATION (unplug your network to test)
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