New demo to test navigator.onLine without events

This commit is contained in:
Remy Sharp 2010-03-20 19:37:02 +00:00
parent 9afc59c23c
commit ddfc822891
1 changed files with 13 additions and 0 deletions

13
demos/nav-online.html Normal file
View File

@ -0,0 +1,13 @@
<title>navigator.onLine testing</title>
<article>
<p>Current network status: <span id="status">checking...</span></p>
<p>A timer is constantly polling the navigator.onLine property, which is typically switched via File -&gt; Work Offline</p>
</article>
<script>
var status = document.getElementById('status')
setInterval(function () {
status.className = navigator.onLine ? 'online' : 'offline';
status.innerHTML = navigator.onLine ? 'online' : 'offline';
}, 250);
</script>