• Web APIs
  • Window
  • Instance properties
    1. credentialless Experimental
    2. devicePixelRatio
    3. documentPictureInPicture Experimental
    4. event Deprecated
    5. external Deprecated
    6. fence Experimental
    7. fullScreen Non-standard
    8. innerWidth
    9. launchQueue Experimental
    10. locationbar
    11. mozInnerScreenX Non-standard
    12. mozInnerScreenY Non-standard
    13. navigation Experimental
    14. orientation Deprecated
    15. originAgentCluster Experimental
    16. performance
    17. screenLeft
    18. scrollbars
    19. scrollMaxX Non-standard
    20. scrollMaxY Non-standard
    21. sessionStorage
    22. sharedStorage Experimental
    23. status Deprecated
    24. trustedTypes
    25. atob()
    26. back() Non-standard Deprecated
    27. blur() Deprecated
    28. captureEvents() Deprecated
    29. clearImmediate() Non-standard Deprecated
    30. confirm()
    31. dump() Non-standard
    32. find() Non-standard
    33. forward() Non-standard Deprecated
    34. getDefaultComputedStyle() Non-standard
    35. getScreenDetails() Experimental
    36. moveTo()
    37. prompt()
    38. queryLocalFonts() Experimental
    39. releaseEvents() Deprecated
    40. requestFileSystem() Non-standard Deprecated
    41. scroll()
    42. scrollByLines() Non-standard
    43. scrollByPages() Non-standard
    44. setImmediate() Non-standard Deprecated
    45. setResizable() Non-standard Deprecated
    46. showDirectoryPicker() Experimental
    47. showModalDialog() Non-standard Deprecated
    48. showOpenFilePicker() Experimental
    49. showSaveFilePicker() Experimental
    50. sizeToContent() Non-standard
    51. webkitConvertPointFromNodeToPage() Non-standard Deprecated
    52. 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. ErrorEvent
    2. HTMLBRElement
    3. HTMLCanvasElement
    4. HTMLDialogElement
    5. HTMLEmbedElement
    6. HTMLFrameSetElement Deprecated
    7. HTMLHtmlElement
    8. HTMLLIElement
    9. HTMLMapElement
    10. HTMLMeterElement
    11. HTMLOptGroupElement
    12. HTMLParagraphElement
    13. HTMLQuoteElement
    14. HTMLSpanElement
    15. HTMLTableColElement
    16. HTMLTemplateElement
    17. HTMLTrackElement
    18. HashChangeEvent
    19. MessageChannel
    20. PageRevealEvent
    21. Plugin Deprecated
    22. PluginArray Deprecated
    23. ValidityState
    24. Promise is handled late, i.e. when a handler is attached to the promise after its rejection had caused an unhandledrejection event.

      This can be used in debugging and for general application resiliency, in tandem with the unhandledrejection event, which is sent when a promise is rejected but there is no handler for the rejection at the time.

  • Syntax

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

    js
    addEventListener("rejectionhandled", (event) => {});
    onrejectionhandled = (event) => {};
    

    Event type

    Event properties

    PromiseRejectionEvent.promise Read only

    The JavaScript Promise that was rejected.

    PromiseRejectionEvent.reason Read only

    A value or Promise.reject().

    Event handler aliases

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

    Example

    You can use the rejectionhandled event to log promises that get rejected to the console, along with the reasons why they were rejected:

    js
    window.addEventListener(
      "rejectionhandled",
      (event) => {
        console.log(`Promise rejected; reason: ${event.reason}`);
      },
      false,
    );
    

    Specifications

    Specification
    HTML
    # handler-window-onrejectionhandled

    Browser compatibility

    BCD tables only load in the browser

    See also