Switched demo to use addEvent method to test in older versions of IE
This commit is contained in:
parent
8c773e8db2
commit
caf1b38f0c
|
@ -26,29 +26,29 @@ li::before {
|
||||||
<p>Note that the test shows that <code>window.ononline</code> and <code>window.onoffline</code> doesn't work (which I thought I had read in the specs somewhere...).</p>
|
<p>Note that the test shows that <code>window.ononline</code> and <code>window.onoffline</code> doesn't work (which I thought I had read in the specs somewhere...).</p>
|
||||||
</article>
|
</article>
|
||||||
<script>
|
<script>
|
||||||
function update(online) {
|
function update(online) {
|
||||||
document.getElementById('viabody').innerHTML = navigator.onLine ? 'Online' : 'Offline';
|
document.getElementById('viabody').innerHTML = navigator.onLine ? 'Online' : 'Offline';
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('online', function () {
|
addEvent(window, 'online', function () {
|
||||||
document.getElementById('vialistener').innerHTML = 'Online';
|
document.getElementById('vialistener').innerHTML = 'Online';
|
||||||
}, false);
|
});
|
||||||
|
|
||||||
window.addEventListener('offline', function () {
|
addEvent(window, 'offline', function () {
|
||||||
document.getElementById('vialistener').innerHTML = 'Offline';
|
document.getElementById('vialistener').innerHTML = 'Offline';
|
||||||
}, false);
|
});
|
||||||
|
|
||||||
window.ononline = function () {
|
window.ononline = function () {
|
||||||
document.getElementById('viaon').innerHTML = 'Online';
|
document.getElementById('viaon').innerHTML = 'Online';
|
||||||
};
|
};
|
||||||
|
|
||||||
window.onoffline = function () {
|
window.onoffline = function () {
|
||||||
document.getElementById('viaon').innerHTML = 'Offline';
|
document.getElementById('viaon').innerHTML = 'Offline';
|
||||||
};
|
};
|
||||||
|
|
||||||
document.body.onOnline = update;
|
document.body.onOnline = update;
|
||||||
document.body.onOffline = update;
|
document.body.onOffline = update;
|
||||||
|
|
||||||
document.body.onload = update;
|
document.body.onload = update;
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue