Notification:icon 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
备注: 此特性在 Web Worker 中可用。
Notification
接口的 icon
只读属性包含将作为通知的一部分显示的图标的 URL,在 Notification()
构造函数的 icon
选项中指定。
值
一个字符串。
示例
在我们的 To-do list app(查看实时运行示例),我们使用 Notification()
构造函数触发通知,并将参数传递给它以指定我们想要的 body、icon 和 title。
js
const notification = new Notification("To do list", {
body: text,
icon: img,
});
规范
Specification |
---|
Notifications API # dom-notification-icon |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
icon |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.