HTML event attribute ononline








The ononline attribute event is triggered when the browser starts to work online.

What's new in HTML5

The ononline attribute is new in HTML5.

Syntax

<element ononline="script or Javascript function name">

Supported Tags

<body>

Browser compatibility

ononline No 8.0 Yes No No




Example

<!DOCTYPE html>
<html>
<body ononline="onFunction()" onoffline="offFunction()">
<!--  www  .j  av a 2 s. co  m-->
<p>Open the File menu and click on "Work Offline" to 
toggle between working online and offline.</p>

<script>
function onFunction() {
    alert ("online.");
}

function offFunction() {
    alert ("offline.");
}
</script>

</body>
</html>

Click to view the demo