MDN self-hosted library · e01.org

Notification: icon property

Web Notifications

Open notebook · 1 cells web-api-instance-property upstream source

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 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

Browser compatibility

See also