``` --- ## Definition and Usage The onoffline"> ``` --- ## Definition and Usage The onoffline" />
Easy Tutorial
❮ Prop Search Disabled Coll Select Options ❯

onoffline Event

Event Object

Example

Execute JavaScript when the browser is working offline:

<body onoffline="myFunction()">

Definition and Usage

The onoffline event is triggered when the browser is working offline.

Tip: The opposite event of onoffline is ononline.

Tip: You can also use the navigator.onLine property to check if the browser is in online or offline mode.


Browser Support

The numbers in the table specify the first browser version that supports the event.

Event
onoffline Not supported Deprecated in IE11 <br>8.0 3.0 Not supported Not supported

Syntax

In HTML:

In JavaScript:

In JavaScript, using the addEventListener() method:

Note: Internet Explorer 8 and earlier versions do not support the addEventListener() method.


Bubbles: No
Cancelable: No
--- ---
Event type: Event
--- ---
Supported HTML tags: <body>
--- ---
❮ Prop Search Disabled Coll Select Options ❯