HTML event attribute onoffline








The onoffline attribute event is triggered when the browser starts to work offline.

What's new in HTML5

The onoffline attribute is new in HTML5.

Syntax

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

Supported Tags

<body>

Browser compatibility

onoffline No 8.0 Yes No No




Example

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {<!--from   w  ww.  jav a  2  s . c  o  m-->
    alert("Page is offline");
    
}
</script>
</head>

<body onoffline="myFunction()">
   <h1>Hello World!</h1>
   
</body>

</html>

Click to view the demo