check internet connection is working or not using javascript

Spread the love

In this fast post I will demonstrate to you Generally accepted methods to check web association is working or not utilizing javascript, There is a capacity in javascript called navigator.onLine, It’ll return genuine or false as the consequence of web network, If you are not associated with the web it’ll return false. In the event that web working fine it’ll return valid as yield status.

Here is the simple javascript function for getting internet status working or not..

Call above function on button onclick event.

You can also use setInterval method in javascript to automatically check internet connectivity, As soon as internet down you can display message to visitors. Function will check for internet in every 5 sec.

Leave a Reply

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