--- title: Notification.onerror slug: Web/API/notification/onerror tags: - Notification.onerror translation_of: Web/API/Notification/onerror ---
{{APIRef("Web Notifications")}}
{{domxref("Notification")}} 接口的 onerror属性指定一个事件侦听器来接收 {{event("error")}} 事件。
当一个 {{domxref("Notification")}} 发生错误时,会发生这些事件(在许多情况下,一个错误阻止显示通知)。
Notification.onerror = EventListener;
A {{jsxref("function")}} which serves as the event handler for the {{event("error")}} event. When an error occurs, the specified function will be called. If null
, no error handler is in effect.
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Notifications','#dom-notification-onerror','onerror')}} | {{Spec2('Web Notifications')}} | Initial specification. |
{{Page("/en-US/docs/Web/API/Notification","Browser compatibility")}}