Monday, March 10, 2014

How to check if the Network is connected or NOT of your phone or system?

We are into the era where the smart phones are dominating the style of living and changing the face of technology.

Everyone is accessing the website from the smartphone or everyone is accepting an app for same.But, same time we can't neglect the backbone of making smartphones such popular - Internet.

So, what if the network is down?

What if user is in the subway where internet coverage is coming and going?

So, how you will handle your code in such situation?Here is the tip: -

navigatior.onLine

All you need to check 

if (!navigator.onLine) {
     // you are not in network
}
else {
   // all is good
}

Happy Coding