Hi guys am here today again to show you guys on how to let a user know when internet connect is lost when a user browsing through your website or accidentally turn of the data connection.
With a simple line of code, you can achieve this by using a JavaScript plugin named offline.js
how it works
Offline.js keeps sending Ajax request to load an Image (1 byte in size) to check the connection. If that ajax call receives 200 Ok status code, then internet connection is UP. If it returns 204 No Content status code, then an Internet connection is Down.
Implementing these is so easy by a few lines of code, you are done. No coding experience required, just copy and paste it
More articles like these navigate to our developer section and enjoy .
How to implement it
Please place the below javascript before
Be first to comment