2010-03-20 20:37:02 +01:00
|
|
|
<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 -> Work Offline</p>
|
|
|
|
</article>
|
|
|
|
<script>
|
2011-09-09 19:28:03 +02:00
|
|
|
var statusElem = document.getElementById('status')
|
2010-03-20 20:37:02 +01:00
|
|
|
|
|
|
|
setInterval(function () {
|
2011-09-09 19:28:03 +02:00
|
|
|
statusElem.className = navigator.onLine ? 'online' : 'offline';
|
|
|
|
statusElem.innerHTML = navigator.onLine ? 'online' : 'offline';
|
2010-03-20 20:37:02 +01:00
|
|
|
}, 250);
|
|
|
|
</script>
|