• Web APIs
  • caches
  • credentialless Experimental
  • devicePixelRatio
  • documentPictureInPicture Experimental
  • event Deprecated
  • external Deprecated
  • fence Experimental
  • fullScreen Non-standard
  • innerWidth
  • launchQueue Experimental
  • locationbar
  • mozInnerScreenX Non-standard
  • mozInnerScreenY Non-standard
  • navigation Experimental
  • orientation Deprecated
  • originAgentCluster Experimental
  • performance
  • screenLeft
  • scrollbars
  • scrollMaxX Non-standard
  • scrollMaxY Non-standard
  • sessionStorage
  • sharedStorage Experimental
  • status Deprecated
  • trustedTypes
  • atob()
  • back() Non-standard Deprecated
  • blur() Deprecated
  • captureEvents() Deprecated
  • clearImmediate() Non-standard Deprecated
  • confirm()
  • dump() Non-standard
  • find() Non-standard
  • forward() Non-standard Deprecated
  • getDefaultComputedStyle() Non-standard
  • getScreenDetails() Experimental
  • moveTo()
  • prompt()
  • queryLocalFonts() Experimental
  • releaseEvents() Deprecated
  • requestFileSystem() Non-standard Deprecated
  • scroll()
  • scrollByLines() Non-standard
  • scrollByPages() Non-standard
  • setImmediate() Non-standard Deprecated
  • setResizable() Non-standard Deprecated
  • showDirectoryPicker() Experimental
  • showModalDialog() Non-standard Deprecated
  • showOpenFilePicker() Experimental
  • showSaveFilePicker() Experimental
  • sizeToContent() Non-standard
  • webkitConvertPointFromNodeToPage() Non-standard Deprecated
  • webkitConvertPointFromPageToNode() Non-standard Deprecated
  • Events
    1. beforeprint
    2. cut
    3. error
    4. hashchange
    5. messageerror
    6. orientationchange Deprecated
    7. pageswap
    8. resize
    9. scrollsnapchange Experimental
    10. scrollsnapchanging Experimental
    11. unload Deprecated
    12. vrdisplayactivate Non-standard Deprecated
    13. vrdisplayconnect Non-standard Deprecated
    14. vrdisplaydeactivate Non-standard Deprecated
    15. vrdisplaydisconnect Non-standard Deprecated
    16. vrdisplaypresentchange Non-standard Deprecated
  • Inheritance
    1. Navigator.onLine switches to false.

  • Syntax

    Use the event name in methods like addEventListener(), or set an event handler property.

    js
    addEventListener("offline", (event) => {});
    onoffline = (event) => {};
    

    Event type

    A generic Event.

    Event handler aliases

    In addition to the Window interface, the event handler property onoffline is also available on the following targets:

    Examples

    js
    / addEventListener version
    window.addEventListener("offline", (event) => {
      console.log("The network connection has been lost.");
    });
    
    / onoffline version
    window.onoffline = (event) => {
      console.log("The network connection has been lost.");
    };
    

    Specifications

    Specification
    HTML
    # handler-window-onoffline

    Browser compatibility

    BCD tables only load in the browser

    See also