There is a easy way to check if the browser as internet access or not. In the wireless and mobile world a check if the loaded page has internet access can be very good, a very easy check can save you alot of problem.
The only thing you need to do is
if(navigator.onLine==true){
alert("Online")
}else{
alert("Offline")
}
To be clear, does this mean that the browser is in offline mode or does it mean that has a valid internet connection?
Could be useful thanks 🙂
I have checked it by loading up a page and removing the wireless connection. And yes it will detect this so it’s not only offline mode in the webbrowser that is detected.
Tense version:
alert(navigator.onLine ? “Online” : “Offline);
you don’t actually need a == true since it is boolean already;
Explaining example with no minify. 😛