In this tutorial we are going to learn how to display offline/online connection status in Javascript using Offline.js. Offline.js is a library to automatically alert your users when they’ve lost internet connectivity, like Gmail,Facebook.

The best part is that 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.