---
title: Notification.onclose
slug: Web/API/Notification/onclose
tags:
  - API
  - Notification
  - Notifications
  - Notifications API
  - Property
  - Reference
  - onclose
browser-compat: api.Notification.onclose
---
{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}

The **`onclose`** property of the {{domxref("Notification")}}
interface specifies an event listener to receive
{{domxref("HTMLDialogElement/close_event", "close")}} events. These events occur when a
{{domxref("Notification")}} is closed.

## Syntax

```js
Notification.onclose = function() { ... };
```

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Notification")}}
- [Using
  the Notifications API](/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API)
