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.
Supported Tags
- <body>
Syntax:
<element onoffline = "script">
Attribute Value: The script event is run when onoffline attribute is called.
Example:
HTML
<!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> |
Output:

Supported Browsers: The browser supported by onoffline event attribute are listed below:
- Chrome 3
- Edge 12
- Firefox 9
- Internet Explorer 9
- Opera 15
- Safari 4





Please Login to comment...