4 ms·
The issue with the OP's implementation and yours is that not all browsers implement navigator.onLine the same way. For example, if you run the jSFiddle on Firef
by sdqali 14y ago
The issue with the OP's implementation and yours is that not all browsers implement navigator.onLine the same way.
For example, if you run the jSFiddle on Firefox, you would see that the status does not change even if you pull out the cable or turn off WiFi. This is because of how Firefox chooses to interpret the spec. However, if you enable offline mode in Firefox (File -> Work Offline), you can see that the status changes.
This issue is described in greater detail here - 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...