Fix: Notification check for IE

This commit is contained in:
2018-12-11 10:47:51 +09:00
parent 6d226d03f5
commit 8ab8437d25
+22 -9
View File
@@ -82,18 +82,31 @@
var timeOutEventID;
function ShowNotifyTimeOver(timeLeft) {
if(Notification) { // except IE
Notification.requestPermission(function (result) {
Notification.permission = result;
var isNotificationIsSupported = !!(window.Notification /* W3C Specification */ || win.webkitNotifications /* old WebKit Browsers */ || navigator.mozNotification /* Firefox for Android and Firefox OS */)
console.log(result);
if(result !== "denied")
if(isNotificationIsSupported) {
if(Notification) { // prepared browser for using Notification
if(Notification.permission === "granted") {
AddNotifyEventByNotification(timeLeft);
else
return;
}
Notification.requestPermission(function (result) {
Notification.permission = result;
if(result === "granted") {
AddNotifyEventByNotification(timeLeft);
return;
}
AddNotifyEventByAlert(timeLeft);
});
} else { // IE
console.log("no notification");
});
} else { // not prepared browser for using Notification
console.log("no notification - !Notification");
AddNotifyEventByAlert(timeLeft);
}
} else { // not prepared browser for using Notification - IE
console.log("no notification - Notification in window");
AddNotifyEventByAlert(timeLeft);
}
}