Notification: icon property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The icon read-only property of the Notification interface returns a string containing the URL of a small image that reinforces the notification — for example, an app logo or a photo of the message sender. It is displayed alongside the notification title and body.
See Notifications with different images for a comparison of the three image options.
Value
A string.
Examples
In our To-do list app (view the app running live), we use the Notification()
constructor to fire a notification, passing it arguments to specify the body, icon and
title we want.
const notification = new Notification("To do list", {
body: text,
icon: img,
});
Specifications
| Specification |
|---|
| Notifications API> # dom-notification-icon> |