Onoffline event
Perform JavaScript while your browser is away from online:
Try it out . . .
Definitions and usages
The onoffline event is triggered when the browser is working offline.
Tip: The opposite of the onoffline event is ononline.
Tip: You can also use navigator.onLine property to wipe whether your browser is online or offline.
Browser support
The numbers in the table support the version number of the first browser for the event.
Event | |||||
---|---|---|---|---|---|
onoffline | Not supported |
IE11 is obsolete
8.0 |
3.0 | Not supported | Not supported |
Grammar
In HTML:
In JavaScript:
In JavaScript, use the addEventListener() method:
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions of IE.
Technical details
Whether to support bubbling: | No |
---|---|
Can I cancel: | No |
Types of events: | Event |
Supported HTML tags: | <body> |
The event object