ononlineEvent
Examples
Execute JavaScript when the browser starts working online:
<body ononline="myFunction()">
Try it Yourself »
Definition and Usage
The ononline event is triggered when the browser starts working online.
Tip:The opposite event of ononline is theonofflineevent.
Tip:You can also use thenavigator.onLineproperty to check whether the browser is in online or offline mode.
Browser Support
The numbers in the table indicate the first browser version that supports this event.
| Event | |||||
|---|---|---|---|---|---|
| ononline | Not supported |
Deprecated in IE11 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, using the addEventListener() method:
object.addEventListener("online", myScript);Try it
Note:Internet Explorer 8 and earlier IE versions do not supportaddEventListener()method.
Technical Details
| Does it support bubbling: | No |
|---|---|
| Can it be cancelled: | No |
| Event type: | Event |
| Supported HTML tags: | <body> |
Event Object Other extensions