Check if current user is online or offline
alert(connection.isOnline === true);
This property checks your internet connection and changes value accordingly. If you have internet connection then it will be "true". Otherwise "false".