目前我要求在桌面通知机构内显示图像,但我不确定是否可能 -
notification = new Notification("title", "user1"), {
icon: baseUrl + '/image/icon.png',
body: "message" // here i want add my custom image
});
如果可能的话我需要实现它的方法。
答案 0 :(得分:2)
您有语法错误,如果您这样写,您可以在通知中放置几乎所有图片/图标。
var notification = new Notification("Hi there!", {
icon: 'http://placekitten.com.s3.amazonaws.com/homepage-samples/96/139.jpg',
body: 'Picture from https://placekitten.com/'
})
请参阅this fiddle - 代码来自mdn
答案 1 :(得分:2)
答案 2 :(得分:2)
您无法在 Notification.body 中添加图片,因为 body 属性只接受根据MDN