onoffline Event

Definition and Usage

The onoffline event occurs when the browser starts working offline.

Tip:onoffline Event with ononline-Ereignis Conversely.

Tip:You can also use navigator.onLine Property to determine whether the browser is in online or offline mode.

Example

Execute JavaScript when the browser starts working offline:

<body onoffline="myFunction()">

Try It Yourself

Syntax

In HTML:

<element onoffline="myScript">

Try It Yourself

In JavaScript:

object.onoffline = function(){myScript};

Try It Yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("offline", myScript);

Try It Yourself

Note:Internet Explorer 8 or earlier versions do not support addEventListener() Method.

Technical Details

Bubbling: Nicht unterstützt
Cancellable: Nicht unterstützt
Event Type: Event
Supported HTML Tags: <body>
DOM Version: Level 3 Events

Browser-Unterstützung

Die Zahlen in der Tabelle weisen auf die erste Browser-Version hin, die das Ereignis vollständig unterstützt.

Ereignisse Chrome IE Firefox Safari Opera
onoffline Nicht unterstützt. Ab IE11 nicht mehr unterstützt
8.0
3.0 Nicht unterstützt Nicht unterstützt