November 2011
Intermediate to advanced
384 pages
13h 23m
English
There are two ways to detect whether a browser is online or offline in JavaScript. The first is to query the navigator.onLine property, if supported, to give the current state of the network connection media. So if the Ethernet cable is unplugged or the Wi-Fi connection is lost, this property is updated. The second way is to listen to the online and offline browser events, if supported, to notify you when the navigator.onLine property changes.
This is true in most browsers and operating systems, but there are some notable exceptions:
Read now
Unlock full access