ononline event
Example
Execute JavaScript when the browser starts working online:
Try it »
Definition and Usage
The ononline event is triggered when the browser starts working online.
Tip: The opposite event of ononline is onoffline events.
Tip: You can also use navigator.onLine the property to check whether the browser is in online or offline mode.
Browser support
The numbers in the table indicate the version number of the first browser to support the event.
| Events | |||||
|---|---|---|---|---|---|
| ononline | Not supported | IE11 deprecated | |||
| 8.0 | 3.0 | Not supported | Not supported |
Syntax
In HTML:
<
element
ononline="
myScript
">Try it
In JavaScript:
object
.ononline=function(){
myScript
};
Try it
In JavaScript, use the addEventListener() method:
object
.addEventListener("online",
myScript
);
Try it
Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.
Technical Details
| Does it support bubbling: | No |
|---|---|
| Is it cancelable: | No |
| Event type: | Event |
| Supported HTML tags: |
Event Object