<html>
<body>
<p>This example uses the HTML DOM to assign an "ononline" and "onoffline" event to a body element.</p>
<p>Open the File menu and click on "Work Offline" to toggle between working online and offline.</p>
<p><strong>Note:</strong> The ononline and onoffline events are only supported in Firefox and Internet Explorer version 8 to 10.</p>
<script>
document.getElementsByTagName("BODY")[0].ononline = function() {onFunction()};
document.getElementsByTagName("BODY")[0].onoffline = function() {offFunction()};
function onFunction() {
alert ("Your browser is working online.");
}
function offFunction() {
alert ("Your browser is working offline.");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_ononline_dom by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:02:57 GMT -->
</html>