The Window.onrejectionhandled
property is an event handler for processing rejectionhandled
events, which are raised when Promise
s are rejected.
Syntax
window.addEventListener("rejectionhandled", function(event) { ... }); window.onrejectionhandled = function(event) { ...};
Examples
window.onrejectionhandled = function(e) { console.log(e.reason); }
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'onrejectionhandled' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 49 | No support[1] | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | No support | No support[1] | No support | No support | No support |
[1] In Firefox, this is implemented but disabled by default. To turn it on, go to about:config and set the dom.promise_rejection_events.enabled
pref to true
.