Fix: Notification check for IE
This commit is contained in:
@@ -82,18 +82,31 @@
|
|||||||
var timeOutEventID;
|
var timeOutEventID;
|
||||||
|
|
||||||
function ShowNotifyTimeOver(timeLeft) {
|
function ShowNotifyTimeOver(timeLeft) {
|
||||||
if(Notification) { // except IE
|
var isNotificationIsSupported = !!(window.Notification /* W3C Specification */ || win.webkitNotifications /* old WebKit Browsers */ || navigator.mozNotification /* Firefox for Android and Firefox OS */)
|
||||||
Notification.requestPermission(function (result) {
|
|
||||||
Notification.permission = result;
|
|
||||||
|
|
||||||
console.log(result);
|
if(isNotificationIsSupported) {
|
||||||
if(result !== "denied")
|
if(Notification) { // prepared browser for using Notification
|
||||||
|
if(Notification.permission === "granted") {
|
||||||
AddNotifyEventByNotification(timeLeft);
|
AddNotifyEventByNotification(timeLeft);
|
||||||
else
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Notification.requestPermission(function (result) {
|
||||||
|
Notification.permission = result;
|
||||||
|
|
||||||
|
if(result === "granted") {
|
||||||
|
AddNotifyEventByNotification(timeLeft);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddNotifyEventByAlert(timeLeft);
|
AddNotifyEventByAlert(timeLeft);
|
||||||
});
|
});
|
||||||
} else { // IE
|
} else { // not prepared browser for using Notification
|
||||||
console.log("no 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);
|
AddNotifyEventByAlert(timeLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user