HTML ononline Attribute

HTML ononline Attribute: The HTML ononline attribute is defined as it fires when the browser starts to work online. This event attribute contains a single value script which works when browser working in online mode. And the HTML4 does not support the online attribute. And also it was newly added to HTML5.

HTML ononline Attribute

The HTML ononline attribute can be applied to the <body> element.

Syntax: <element ononline=”script”>

Browser Support:

This attribute is supported by the following browsers:

  • Chrome- does not support
  • Firefox-3.0
  • Safari-does not support
  • Opera-does not support
  • Internet Explorer-8.0

Example: for <body> element

<!DOCTYPE html>
<body ononline="onFunction()" onoffline="offFunction()">
<p>Open the File menu and click on "Work Offline" to toggle between working online and offline.</p>
function onFunction() {
  alert ("Your browser is working online.");

function offFunction() {
  alert ("Your browser is working offline.");

HTML ononline attribute