0

i am using following code to check user is online or offline but it is showing me online even i am offline.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Check Internet Connection using jQuery</title>
    <script type="text/javascript">
        function checkconnection() {
            var status = navigator.onLine;
            if (status) {
                alert("online");
            } else {
                alert("offline");
            }
        }
    </script>
</head>
<body>
    <div>
        <input type="button" value="Check Connection" onclick="checkconnection()" />
    </div>
</body>

eisbehr
  • 12,243
  • 7
  • 38
  • 63
bhavika
  • 123
  • 1
  • 13
  • 1
    Your code looks fine in general. What browser are you using? Maybe your browser didn't support it or you're not offline. ;) And btw, you wrote: `Check Internet Connection using jQuery` but this is no jQuery at all. It is plain JS! – eisbehr Aug 03 '16 at 07:42
  • can u please give me some tips to check status that user is online or offline – bhavika Aug 08 '16 at 11:36

0 Answers0