How can I detect if the navigator changed your state to online/offline?
something like:
var oldState = navigator.onLine;
window.navigator.onlinechange = function(evnt,newState) {
alert('your changed from' + oldState + ' to' + newState + 'state');
}
With the help of classes on body and this code you can find
window.ononline = function() {
alert('You are now online');
}
window.onoffline = function() {
alert('You are now offline');
}
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