GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Notification: icon property

Web Notifications

Web Notifications

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](/docs/Web/API/ServiceWorkerRegistration/showNotification#notifications_with_different_images) for a comparison of the three image options.

## Value

A string.

## Examples

In our [To-do list app](https://github.com/mdn/dom-examples/tree/main/to-do-notifications) ([view the app running live](https://mdn.github.io/dom-examples/to-do-notifications/)), we use the Notification()
constructor to fire a notification, passing it arguments to specify the body, icon and
title we want.

```js
const notification = new Notification("To do list", {
body: text,
icon: img,
});
```

## Specifications

## Browser compatibility

## See also

- [Using the Notifications API](/docs/Web/API/Notifications_API/Using_the_Notifications_API)

source: MDN Web Docs mirror · page

Cite this

"Notification: icon property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/Notification/icon

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·