Display online offline connection status using JavaScript

Last Reply one year ago By dharmendr

Posted one year ago

How to displaying online offline connection status in page.

how to display a kind of popup when the network is not connected to the internet.

Posted one year ago

Hi arie.keren,

Check this example. The following code executes on every two second and checks if connection is there or not.


<script type="text/javascript">
    window.onload = function () {
        setInterval(function () {
            if (!navigator.onLine) {
                alert("You are not connected to Internet, ensure you're not in airplane mode. \n\nYour internet signal may be week. \n\nPlease connect to internet and try again.");
        }, 2000);