locked
Check if Internet Connectivity exists ??? RRS feed

  • General discussion

  • kindly help me … how to check internet connectivity in winjs ...

    var ip =Windows.Networking.Connectivity.NetworkInformation

    ip= networkInfo.getInternetConnectionProfile();

    after that how to check the internet connectivity?

    Tuesday, March 27, 2012 7:34 AM

All replies

  • Hi Cynthia,

    Here's the function I wrote for checking if there was any connectivity.

    function isConnected() {
        var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
        if (profile) {
            return (profile.getNetworkConnectivityLevel() != Windows.Networking.Connectivity.NetworkConnectivityLevel.none);
        }
        else {
            return false;
        }
    }

    Cheers,
    -Jeff

    Tuesday, March 27, 2012 4:07 PM