Check Internet Connection Status using HTML, CSS, and Javascript

Ashutosh Tiwari
2 min readFeb 13, 2022

--

Hello readers, today in this blog you’ll learn how to create a toast notification for checking the internet connection using HTML, CSS, and Javascript. In our previous blog, we saw how to create a share modal dark UI design using HTML, CSS, and Javascript. Earlier, I have shared many blogs on Javascript Projects but in that project still, I haven’t shared how you can check the internet connection status in JavaScript.

In this program [Check Internet Connection Status] we have a webpage with an awesome toast notification and it changes its icon, color and, text according to your internet connection status as you can see in the preview image above. It has a cool animation effect which means when your internet connection status changes it comes from the top-right side with a sliding animation.

You may like these:-

The concepts/codes behind creating this program are so simple. In javascript, we have a concept of Window Navigator Object This navigator object contains information about the browser. This navigator object can be accessed with Window.navigator OR navigator only. In this object, we get an online parameter that returns the true or false value which means if the return value is true So the user has internet access else the user doesn’t have internet access.

In this program [Check Internet Connection Status] we are using window.addEventListener to detect the internet connection status. If you’re unable to understand what am I trying to say So you can check the source code and preview as well.

Visit this website to check source code and preview:

https://incoderweb.blogspot.com/2022/02/check-internet-connection-status-using.html

--

--

No responses yet