diff --git a/src/web/client/license_timer.html b/src/web/client/license_timer.html index 4b697a0..9642029 100644 --- a/src/web/client/license_timer.html +++ b/src/web/client/license_timer.html @@ -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); } }