This example uses the HTML DOM to assign an "ononline" and "onoffline" event to a body element.
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.