html tutorial - onoffline Attribute in HTML - html5 - html code - html form



onoffline attribute in html

Learn html - html tutorial - onoffline attribute in html - html examples - html programs

  • The onoffline attribute triggers when the browser starts work offline.

Syntax for onoffline attribute in HTML:

<element onoffline="script">

Difference between HTML 4.01 and HTML 5 for onoffline Attribute:

HTML 4.01

  • HTML 4 does not support onoffline attribute.

HTML 5

  • HTML 5 supports onoffline attribute.

Applies To:

Element Attribute
<body> onoffline

onoffline Attribute Value:

Value Description
script The script to be run on onoffline

Sample Coding for onoffline Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy onoffline attribute</title>
    </head>
    <body onoffline="offline()">
    <h2>Goto file menu and click “Work Offline”</h2>
        <p>
            Learn to Code in Wikitechy<br>  
            Teach people how different technologies are organized<br> 
        <b>Note:</b>onoffline only supported in Firefox and
        Internet Explorer version 8 to 10.</p>
        <script>
         function offline()
         {
             alert ("You are working in offline.");
         }                  
        </script>
    </body>
</html>

Code Explanation for onoffline Attribute in HTML:

onoffline Attribute Code Explanation

  1. onoffline attribute used to trigger an event when the browser starts working in offline.
  2. offline JavaScript function used to show an alert message “You are working in offline.”

Output for onoffline Attribute in HTML:

onoffline Attribute Output

  1. Goto File menu in the browser and chose “Work Offline”.
  2. onoffline Attribute Output
  3. The Window shows an alert message “You are working in offline.”

Browser Support for onoffline Attribute in HTML:

No 8.0-10.0 3.0 No No

Tips and Notes

  • onoffline attribute only supported in Firefox and Internet Explorer version 8 to 10.

Related Searches to onoffline attribute in html