--- title: Notification.onerror slug: Web/API/notification/onerror tags: - Notification.onerror translation_of: Web/API/Notification/onerror ---

{{APIRef("Web Notifications")}}

Summary

{{domxref("Notification")}}  接口的 onerror属性指定一个事件侦听器来接收 {{event("error")}} 事件。

当一个 {{domxref("Notification")}} 发生错误时,会发生这些事件(在许多情况下,一个错误阻止显示通知)。

 

Syntax

Notification.onerror = EventListener;

Value

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.

Specifications

Specification Status Comment
{{SpecName('Web Notifications','#dom-notification-onerror','onerror')}} {{Spec2('Web Notifications')}} Initial specification.

Browser compatibility

{{Page("/en-US/docs/Web/API/Notification","Browser compatibility")}}

See also