Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | onoffline Event Attribute

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 16 Aug, 2022
Improve Article
Save Article

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>


<element onoffline = "script">

Attribute Value: The script event is run when onoffline attribute is called.



<!DOCTYPE html>
        <title>onoffline event attribute</title>
            h1 {
            body {
    <body onoffline = "gfg()">
        <h2>onoffline Event Attribute</h2>
            function gfg() {
                alert ("Browser working in offline mode");


onffline event

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


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!