mirror of
https://github.com/Erreur32/html5demos.git
synced 2024-09-30 02:51:29 +02:00
New demo to test navigator.onLine without events
This commit is contained in:
parent
9afc59c23c
commit
ddfc822891
13
demos/nav-online.html
Normal file
13
demos/nav-online.html
Normal 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 -> 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>
|
Loading…
Reference in New Issue
Block a user