Created
July 29, 2009 23:49
-
-
Save shazron/158461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PhoneGap Reachability Support | |
function testReachable() { | |
// no http:// prefix! | |
navigator.network.isReachable("www.google.com", testReachable_callback); | |
// OR by ipAddress | |
navigator.network.isReachable("212.32.454.32", testReachable_callback, { isIpAddress: true}); | |
} | |
// NetworkStatus: 0 for NotReachable, 1 for ReachableViaCarrierDataNetwork, | |
// 2 for ReachableViaLocalWifiDataNetwork | |
function testReachable_callback(reachability) | |
{ | |
alert("hostName: " + reachability.hostName + " " + | |
"ipAddress: " + reachability.ipAddress + " " + | |
"remoteHostStatus: " + reachability. remoteHostStatus + " " + | |
"internetConnectionStatus: " + reachability. internetConnectionStatus + " " + | |
"localWiFiConnectionStatus: " + reachability. localWiFiConnectionStatus | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment