online testing
<!DOCTYPE html> <html> <head> <title>Test offline</title> </head>/*from w w w . j av a 2 s . co m*/ <body> <script> if (navigator.onLine) { console.log('online') } else { console.log('offline'); } window.addEventListener("offline", function(e) { console.log("offline"); }, false); window.addEventListener("online", function(e) { console.log("online"); }, false); </script> </body> </html>