HTML | onoffline Event Attribute
The onoffline event attribute works when the browser work in offline mode. It is supported by <body> tag only. It is an opposite of ononline event attribute.
Syntax:
<element onoffline = "script">
Attribute Value: The script event is run when onoffline attribute is called.
Example:
<!DOCTYPE html> <html> <head> <title>onoffline event attribute</title> <style> h1 { color:green; } body { text-align:center; } </style> </head> <body onoffline = "gfg()"> <h1>GeeksforGeeks</h1> <h2>onoffline Event Attribute</h2> <script> function gfg() { alert ("Browser working in offline mode"); } </script> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browser supported by onoofline event attribute are listed below:
- Firefox 3.0
- Internet Explorer 8.0
Recommended Posts:
- HTML | DOM onoffline Event
- HTML | onmouseout Event Attribute
- HTML | onclick Event Attribute
- HTML | oncontextmenu Event Attribute
- HTML | ononline Event Attribute
- HTML | onwheel Event Attribute
- HTML | oninput Event Attribute
- HTML | onchange Event Attribute
- HTML | ondblclick Event Attribute
- HTML | onmouseup Event Attribute
- HTML | onmousemove Event Attribute
- HTML | onload Event Attribute
- HTML | ondragover Event Attribute
- HTML | onpaste Event Attribute
- HTML | oninvalid Event Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



