Check Internet Connectivity -- JavaScript


Offline.js is a library to automatically alert your users when they've lost internet connectivity, like Gmail.



It captures AJAX requests which were made while the connection was down, and remakes them when it's back up, so your app reacts perfectly.




Index.html



//for css



<link rel="stylesheet" href="assets/css/offline-theme-chrome.css" />

<link rel="stylesheet" href="assets/css/offline-language-english.css" />



//the script function checks the internet connection every 5 seconds



<script src="assets/js/offline.min.js"></script>

<script>



    var run = function(){

     if (Offline.state === 'up')

         Offline.check();

     }

     setInterval(run, 5000);

   

</script>



check for Demo Click Here.



To Download JS files visit the official website or Click Here



To Download CSS files visit the official website or Click Here(offline-language-english.css),  Click Here(offline-theme-chrome.css)



For more information please visit the below website



http://github.hubspot.com/offline/docs/welcome/



Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.