[英]How to styling the HTML5 desktop Notification?
我尝试为我的网站制作桌面通知,我发现这个指南很有用。 并成功完成了它。
我也在这里发布代码:
HTML:
<button id='button'>Notify me!</button>
JS:
$('input[type=button]').click(notifyMe);
function notifyMe() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
} else if (Notification.permission === "granted") {
var options = {
body: "This is the body of the notification",
icon: "icon.jpg",
dir: "ltr"
};
var notification = new Notification("Hi there", options);
} else if (Notification.permission !== 'denied') {
Notification.requestPermission(function(permission) {
if (!('permission' in Notification)) {
Notification.permission = permission;
}
if (permission === "granted") {
var options = {
body: "This is the body of the notification",
icon: "icon.jpg",
dir: "ltr"
};
var notification = new Notification("Hi there", options);
}
});
}
}
我的问题是 ,有一种方法可以改变它的默认样式吗?
我担心编辑的内容比你正在做的更多。 像警报元素一样,它是格式化通知的浏览器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.