Latest web development tutorials

onoffline event

Event Object Reference Event objects

Examples

Execute JavaScript in the browser from work online:

<Body onoffline = "myFunction ()">

try it"


Definition and Usage

onoffline event triggered when the browser working offline.

Tip: Instead event onoffline event is ononline .

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


Browser Support

Figures in the table represent the first browser to support this version of events.

event
onoffline not support IE11 obsolete
8.0
3.0 not support not support


grammar

In HTML:

<Elementonoffline = "myScript"> try

In JavaScript:

object .onoffline = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "offline", myScript ); try

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


technical details
Whether to support the bubble: No
It can be canceled: No
Event Type: Event
Supported HTML tags: <Body>


Event Object Reference Event objects