HTML ononline Event Attribute

Description

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.

Syntax

<element ononline="script">

Values

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

Example

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

<script>
function onFunction() {
    alert ("Your browser is online.");
}

function offFunction() {
    alert ("Your browser is offline.");
}
</script>

</body>
</html>

Supported Tags

<body>

Browser Support

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