Detect Internet connection in HTML5

In this quick post we will detect whether browser is connected to Internet or not? There are two ways you can detect it

  1. By making a AJAX call and setting the TimeOut property
  2. Using HTML5

In HTML5 you can detect it as following

1.png

This is supported in all modern browsers. In this way you can detect whether browser is connected to Internet or not. 

Ebook Download
View all
Learn
View all