Open In App

HTML | ononline Event Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The ononline event attribute works when the browser starts working in online mode. it is opposite to onoffline event attribute.
Supported Tags 

  • <body>

syntax 
 

<element ononline = "script">

Attribute Value: This event attribute contains single value script which works when browser working in online mode.
Example: 
 

html




<!DOCTYPE HTML>
<html>
    <head>
        <title>
            ononline Event Attribute
        </title>
         
        <script>
            function onfunction() {
                alert("Browser is online");
            }
            function offunction() {
                alert("browser is offline");
            }
        </script>
    </head>
 
    <!-- ononline event used here -->
    <body ononline = "onfunction()"
        onoffline = "offunction()">
    </body>
</html>                           


Output: 
 

Supported Browser: 

  • Chrome 3
  • Edge 12
  • Firefox 9
  • Internet Explorer 9
  • Opera 15
  • Safar 4 

Last Updated : 16 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads