HTML ononline Event Attribute


The event attribute ononline occurs when the browser starts working online (when connected to the Internet). It can be used to notify the user that the Internet connection has been restored, or to enable functions that have been disabled using the onoffline attribute.


<element ononline="script">


  • scriptThe name of the script to use when the event has been triggered.


<body ononline="onFunction()" onoffline="offFunction()">

<p>Open the File menu and click on the “Work offline” button to switch between working on onlie and offline.</p>

<p><strong>Note:</strong>Ononline and onoffline events are supported only in Firefox and Internet Explorer from versions 8 to 10.</p>

function onFunction() {
    alert ("Your browser is online.");

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


Supported Tags


Browser Support

Explorer Edge Chrome Firefox Opera Safari
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung