title: check if network connection exists in javascript
body: <p>I want to check if network connection exists at runtime in javascript. I am using window.navigator.onLine but its not working.</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  
  alert(window.navigator.onLine);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>it is returning true always </p>