title: detect change on navigator.online
body: <p>How can I detect if the navigator changed your state to online/offline?</p>
  
  <p>something like: </p>
  
  <pre><code>var oldState = navigator.onLine; 
  window.navigator.onlinechange = function(evnt,newState) { 
           alert('your changed from' + oldState + ' to' + newState + 'state');
  }
  </code></pre>