check internet connection status

This java script example demonstrates that,  whether your browser is online or offline.

<html>
<head>
</head>
<body>
<h1> Check internet connection status </h1>
 <script>
    function status()
    {
        if(navigator.onLine)
        {
alert("You are Online!")
}
        else
        {
alert("You are Offline!")
        }
    }

</script>
<button onclick="status();">check internect connection 

status </button>
<br>
<h1> This is refresh code </h1>
<a href="javascript:location.reload(true)">Refresh 

Now!</a>
</script>
</body>
</html>

Out put of the above code is :

 

Share
Share
Scroll to Top