ononline Event

Example

Call a function when the browser starts to work online:

<body ononline="myFunction()">
Try it Yourself »

More examples below.


Description

The ononline event occurs when the browser starts to work online.

The ononline event is the opposite of the onoffline event.


Note

You can also use the navigator.onLine property to find out if the browser offline.



Syntax

In HTML:

<element ononline="myScript">
Try it Yourself »

In JavaScript:

object.ononline = function(){myScript};
Try it Yourself »

In JavaScript, using the addEventListener() method:

object.addEventListener("online", myScript);
Try it Yourself »

Technical Details

Bubbles: No
Cancelable: No
Event type: Event
HTML tags: <body>
DOM Version: Level 3 Events

Browser Support

ononline is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.