cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <>
Subject [jira] [Closed] (CB-1846) Offline event doesn't work
Date Thu, 15 Nov 2012 18:14:12 GMT


Andrew Grieve closed CB-1846.

    Resolution: Invalid

Looked at your app. The problem is that you're never attaching your offline listener because
onLoad is never called from anywhere. I changed:

 <body onload="DisplayDateTime();">


 <body onload="DisplayDateTime();onLoad()">

and it works fine on the first page load. You have a multi-page app here by the looks of it
though, so watch out for the bug Simon mentioned where offline events don't work on other
page loads. You may want to pull in the fix for that to your app.
> Offline event doesn't work
> --------------------------
>                 Key: CB-1846
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.2.0
>         Environment: Samsung Galaxy S2 and Google Nexus 7
>            Reporter: Remzi Cavdar
>            Assignee: Joe Bowser
>             Fix For: 2.2.0
>         Attachments: Menofood
> The offline event doesn't work and I had said this before release, but you guys wanted
to release PhoneGap 2.2.0 
> This is my code:
> document.addEventListener("deviceready", onDeviceReady, false);
> function onDeviceReady() {
> 	document.addEventListener("offline", function() {
> 		alert("Er is geen internet verbinding!\nSchakel Wifi of 3G in");
> 	}, false);
> }
> /* English: alert("No internet connection!\nPlease turn on Wifi or 3G");  */

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