LISTEN FOR ONLINE AND OFFLINE EVENTS
When you have two levels of connectivity detection, browser online and offline — which is typically physical media connectivity or in-browser online/offline mode — and network online and offline — which is the actual access online to your web server — you can begin modifying your web application to react properly to both groups of online and offline events:
addEventListener('online', function(){ // The browser has come online. }, false); addEventListener('offline', function(){ // The browser has gone offline. }, false); addEventListener('netonline', function(){ // The network has come online. }, false); addEventListener('netoffline', function(){ // The network has gone offline. }, false);
Considering that ...
Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.