Check internet connection on webpage

We can check the internet connection so that if there is no internet in between we can let user know that no internet connection.
Here in below example we call the checkInternetConnection() function periodically. So that we can detect the internet connection on web page.

Here we are checking internet connection by navigator.onLine. It returns true if there is internet connection and returns false if there is no internet connection. 

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *