ononline = onFunction(); - Javascript DOM Event

Javascript examples for DOM Event:Element Event Attribute

Description

The ononline event occurs when the browser starts to work online.

Summary

Bubbles No
Cancelable No
Supported HTML tags: <body>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<script>
document.getElementsByTagName("BODY")[0].ononline = function() {onFunction()};
document.getElementsByTagName("BODY")[0].onoffline = function() {offFunction()};

function onFunction() {//from   www . ja  v  a 2 s.co  m
    console.log("Your browser is working online.");
}

function offFunction() {
    console.log("Your browser is working offline.");
}
</script>

</body>
</html>

Related Tutorials