From eda2bf95979a83845c2864b3f3be4499ac023c54 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Thu, 24 Oct 2013 15:26:37 +0200 Subject: [PATCH] Check for Notification support --- js/websockets.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/js/websockets.js b/js/websockets.js index c29e9e5..dfc7a14 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -323,13 +323,18 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers', weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', function ($rootScope, $scope, $store, $timeout, $log, models, connection, testService) { - // Request notification permission - Notification.requestPermission(function (status) { - $log.info('Notification permission status:',status); - if (Notification.permission !== status) { - Notification.permission = status; - } - }); + + if(Notification != undefined) { + + // Request notification permission + Notification.requestPermission(function (status) { + $log.info('Notification permission status:',status); + if (Notification.permission !== status) { + Notification.permission = status; + } + }); + + } if(window.webkitNotifications != undefined) { if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED $log.info('Notification permission status:', window.webkitNotifications.checkPermission() == 0);