JS check online status

by Chan Wu

HTML

<div id="online">status</div>

JavaScript

var counter = 0;
setInterval(function() {
    $('#online').html(++counter + ' ' + window.navigator.onLine);
}, 5000);