// 请求显示通知的权限
Notification.requestPermission().then(function(permission) {
if (permission === 'granted') {
// 创建通知对象
var notification = new Notification('哇真的是你呀', {
body: '你干嘛哎哟#@!~哈哈amagi',
icon: '/path/to/icon.png'
});
// 处理通知点击事件
notification.onclick = function() {
console.log('你干嘛!');
};
}
});
标签:function,浏览器,permission,Notification,JS,notification,推送,icon
From: https://www.cnblogs.com/crispyChicken/p/17348521.html