[英]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.