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.


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

Supported Tags


Browser compatibility

ononline No 8.0 Yes No No


<!DOCTYPE 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>

function onFunction() {
    alert ("online.");

function offFunction() {
    alert ("offline.");


Click to view the demo