Skip to content Skip to sidebar Skip to footer

Phonegap Interent Connectivity

I'm developing a jquery mobile app using phonegap build, I search on the web and I got a script on an alert which tells you are online. I've been working around the script with the

Solution 1:

document.addEventListener("deviceready", onLoad, false);
var Status = "";

OR

<body onLoad="onLoad()">

function onLoad() {       
  document.addEventListener("offline", offLine, false);
  document.addEventListener("online", onLine, false);
}

function offLine() { 
  alert("offLine");
  if(Status != 'disconnected') {
     Status = 'disconnected';
    // Your code
  }
}

function onLine() { 
   alert("onLine");
   if(Status != 'connected' && Status != '') {
     Status = 'connected';    
  }
}

Post a Comment for "Phonegap Interent Connectivity"