cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shazron Abdullah (JIRA)" <>
Subject [jira] [Commented] (CB-2096) Online/Offline events no longer trigger when event listener is added
Date Sat, 22 Dec 2012 00:47:14 GMT


Shazron Abdullah commented on CB-2096:

I can confirm on iOS. Using the full example, it appears that the event fires before you can
call document.addEventListener on it in the page.

Using the same example, the workaround is to add your event listener in the onLoad call, before
listening for deviceready.

function onLoad() {
      document.addEventListener("online", onOnline, false);
      document.addEventListener("deviceready", onDeviceReady, false);

> Online/Offline events no longer trigger when event listener is added
> --------------------------------------------------------------------
>                 Key: CB-2096
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS, iOS
>    Affects Versions: 2.2.0
>         Environment: Android 4.1, 4.2, iOS 6. Affects both simulators and devices.
>            Reporter: Kuan Yi Ming
>            Assignee: Shazron Abdullah
>            Priority: Minor
> The online and offline event behaviour has changed from 2.1.0 to 2.2.0. In 2.1.0, the
online event fires immediately when the event listener was added if there is an Internet connection,
but doesn't in 2.2.0. Those events work fine in all other instances though when turning on/off
mobile data etc. Is this change by design, or is it a bug?
> Use the full example from

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message