4 ms·
works in chrome, doesn't work in an admittedly old firefox or IE8
by jamespo 14y ago
works in chrome, doesn't work in an admittedly old firefox or IE8
- flux_w42 14y agoSame for me. Works perfectly in Chrome 23.0.1271.64 but not in Firefox 17.0, but tested on Ubuntu 12.04
- adam-a 14y agoThe FF window.navigator.onLine event fires when you click the "Work offline" option in the menu, at least I think it used to. Just tried that and it didn't work either. I have been looking for a X-browser way to do this myself and the best I cam up with so far was to ping google.com with a XHR OPTIONS type request. Pretty ugly, but it works.
- sdqali 14y agoWould not a better solution be to ping a resource on the application server rather than an external resource (in this case Google)? If the resource can't be pinged, it means either the user is offline or the app is down which are essentially the same thing for your app in most cases, while in your implementation, it could just mean Google.com is down (There is very low chance of this happening. Still..) EDIT: Made the second paragraph clearer.
- stuaxo 14y agoHm, I clicked 'work offline' in firefox and didn't see the demo page do anything - maybe I'm missing something.
- adam-a 14y agoYes, you're right. I know that that was the behaviour at some point in the past on OSX. But I tried just now on Windows, FF Nightly and saw nothing. Could be a change in FF, difference in os's, or something in the library. Not a very helpful comment I'm afraid.
- elliottcarlson 14y agoDidn't work for me in Chrome 22.0.1229.94 on Windows * Worked after I relaunched Chrome and updated to 23.0.1271.64
- sdqali 14y agoThis library depends on the navigator.onLine spec. It does not work on Firefox as expected because it implements navigator.onLine differently from Chrome and IE. http://schalk-neethling.com/2011/05/navigator-online-and-the-differing-implementations-of-a-standard/ http://schalk-neethling.com/2011/05/navigator-online-and-the...