我正在使用HTML5桌面通知。它運行良好,根據我的要求給我適當的輸出。現在,我想要顯示該通知,直到用戶手動關閉該通知爲止,可能我的代碼如下所示。如何將HTML5桌面通知的關閉時間更改爲不自動關閉?
function notifyMe() {
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
else if (Notification.permission === "granted") {
var options = {
body: "due to your inactive response timer is stoped automatically. Start your timer again.",
dir : "ltr"
};
var notification = new Notification("Your timer is stop",options);
}
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
if (!('permission' in Notification)) {
Notification.permission = permission;
}
if (permission === "granted") {
var options = {
body: "due to your inactive response timer is stoped automatically. Start your timer again.",
dir : "ltr"
};
var notification = new Notification("Your timer is stop",options);
}
});
}
}
是我也在爲此尋找解決方案。某處我已經爲此解決方案 autoClose:0 但如果任何人有解決方案,這是行不通的,那麼請儘快給我。 – 2014-12-04 10:16:24
[防止Firefox Web通知自動關閉]的可能重複(https://stackoverflow.com/questions/19144097/prevent-firefox-web-notifications-from-automatically-closing) – John 2018-01-05 12:17:28
重複*更高質量*和*更舊發佈:https://stackoverflow.com/questions/19144097/prevent-firefox-web-notifications-from-automatically-closing – John 2018-01-05 12:17:56