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.


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

Supported Tags


Browser compatibility

onoffline No 8.0 Yes No No


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

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


Click to view the demo