jQuery Plugin To Detect Internet Connection Via AJAX - hoffline

jQuery Plugin To Detect Internet Connection Via AJAX - hoffline
File Size: 6.78 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

hoffline is a lightweight jQuery Internet Connection detection plugin which displays online/offline messages to users depending on the current connection status. The goal of the plugin is to request a specific image on a given interval via AJAX and warn your users when their network goes down.

How to use it:

1. Load the jQuery hoffline plugin's script after jQuery library as this.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="hoffline.js"></script>

2. Initialize the plugin on document ready and we're done.

HOffine();

3. Style the warning message in the CSS:

span#currentInternetStatus { 

  color: #f00;

}

4. Plugin's default configuration options.

HOffine({
  imgurl: "dot.png",
  selectorTag: "span",
  selectorNewId: "currentInternetStatus",
  getStatusOnTimeInterval: 5000,
  selectorToAppend: "body"
});

This awesome jQuery plugin is developed by himadhar. For more Advanced Usages, please check the demo page or visit the official website.