WorkerGlobalScope.onoffline

The onoffline property of the WorkerGlobalScope interface represents an event handler to be called when the offline event occurs.

Syntax

self.onoffline = function() { ... };

Example

The following code snippet shows an onoffline handler set inside a worker:

self.onoffline = function() {
  console.log('Your worker is now offline');
}

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
onoffline
4
≤79
29
No
?
8
40
40
29
?
8
4.0

See also

The WorkerGlobalScope interface it belongs to.

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/onoffline