This example uses the addEventListener() method to attach a "online" and "offline" event to the window object.
Open the File menu and click on "Work Offline" to toggle between working online and offline.
Note: The ononline and onoffline events are only supported in Firefox and Internet Explorer version 8 to 10.