Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

online | ononline event

Raised when Windows Internet Explorer is working online.

This event is not supported for Windows Store apps using JavaScript.

Syntax

HTML Attribute <element ononline = "handler(event)">
Event Property object.ononline = handler;
addEventListener Method object.addEventListener("online", handler, useCapture)

 

Event information

SynchronousNo
BubblesNo
CancelableNo

 

Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

There are no standards that apply here.

Remarks

If Asynchronous JavaScript and XML (AJAX) Connection Services are disabled, this event is not raised. (These services are enabled by default.)

To invoke this event, do one of the following:

  • Clear the check next to "Work Offline" on the File menu.

Examples

The following example sets an event handler that responds to both ononline and onoffline events using the type property of the event object.


function reportConnectionEvent(e)
{
    if (!e) e = window.event;
    
    if ('online' == e.type) {
        console.log( 'The browser is ONLINE.' );
    }
    else if ('offline' == e.type) {
        console.log( 'The browser is OFFLINE.' );
    }
    else {
        console.log( 'Unexpected event: ' + e.type );
    }
}
window.onload = function() {
    document.body.ononline = reportConnectionEvent;
    document.body.onoffline = reportConnectionEvent;
}  

See also

body
window
Reference
onLine
onoffline

 

 

Show:
© 2015 Microsoft