The Notification interface of the Notifications API is used to configure and display desktop notifications to the user.
The Notifications API allows web pages to control the display of system notifications to the end user — these are outside the top-level browsing context viewport, so therefore can be displayed even the user has switched tabs or moved to a different app. The API is designed to be compatible with existing notification systems across different platforms.
The Notification() constructor creates a new Notification object instance.
The requestPermission() method of the Notification interface requests permission from the user for the current origin to display notifications.
The timestamp read-only property of the Notification interface returns a DOMTimeStamp, as specified in the timestamp option of the Notification() constructor.
The actions read-only property of the Notification interface returns the actions array of the notification as specified in the options parameter of the Notification() constructor.
The body read-only property of the Notification interface indicates the body string of the notification, as specified in the body option of the Notification() constructor.
The close() method of the Notification interface is used to close a previously displayed notification.
The data read-only property of the Notification interface returns a structured clone of the notification's data, as specified in the data option of the Notification() constructor.
The dir read-only property of the Notification interface indicates the text direction of the notification, as specified in the dir option of the Notification() constructor.
The icon read-only property of the Notification interface contains the URL of an icon to be displayed as part of the notification, as specified in the icon option of the Notification() constructor.
The lang read-only property of the Notification interface indicates the text direction of the notification, as specified in the lang option of the Notification() constructor.
The onclick property of the Notification interface specifies an event listener to receive click events. These events occur when the user clicks on a displayed Notification.
The onerror property of the Notification interface specifies an event listener to receive error events. These events occur when something goes wrong with a Notification (in many cases an error preventing the notification from being displayed.)
The permission read-only property of the Notification interface indicates the current permission granted by the user for the current origin to display web notifications.
The renotify read-only property of the Notification interface specifies whether the user should be notified after a new notification replaces an old one, as specified in the renotify option of the Notification() constructor.
The sticky read-only property of the Notification interface specifies whether the notification should be 'sticky' or not. When we say a notification is sticky, it means that notification is not easily clearable by the user. This is specified in the sticky option of the Notification() constructor.
The tag read-only property of the Notification interface signifies an identifying tag for the notification, as specified in the tag option of the Notification() constructor.
The title read-only property of the Notification interface indicates the title of the notification, as specified in the title parameter of the Notification() constructor.