Short of consistent behavior, would it be fair to recommend best practice to assume the event may fire soon after deviceready, prior to which you might test connection.type? From the POV of HTML5-savvy developers, do any of these platforms' devices not support the corresponding navigator.onLine property?
--Mike S ________________________________________ From: Ray Camden Sent: Tuesday, May 21, 2013 5:52 PM To: dev@cordova.apache.org Cc: Michael Sierra Subject: Re: cordova API doc queries Are you sure? I built a demo a while ago to show connection handling, and I had to check during start up as well as use events. I just tested with PhoneGap 2.6 and Ripple, and on Chrome, it did *not* fire an event handler for network change when the app started. On 5/20/13 4:05 PM, "Shazron" <shaz...@gmail.com> wrote: > >> * Do relevant online/offline events fire when the app starts up, or >> only when a change is detected during execution? The text for the >> offline event iOS quirk implies the former case: "During initial >> startup, the first offline event (if applicable) takes at least a >> second to fire." If it fires when the app inits, is the value of >> navigator.onLine true or false during that 1-second delay? >> >> >During both startup and when a change is detected. > >navigator.onLine is tied to the connection API: >https://github.com/apache/cordova-js/blob/2d15c4045aab52f8b2d728bd90244894 >258b3b47/lib/common/plugin/network.js#L30-L34 > >During that iOS delay, it will be 'unknown' then after it should reflect >the right value.