From 8b8ba5875fddcd45a7cac07965b49da64ed95f0c Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 18 Jan 2018 03:10:15 +0200 Subject: [PATCH] Fix for browsers without SW (#805) * Fix for browsers without SW * Improve check --- src/components/ha-push-notifications-toggle.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ha-push-notifications-toggle.html b/src/components/ha-push-notifications-toggle.html index c79324a3ab..bd85a282e8 100644 --- a/src/components/ha-push-notifications-toggle.html +++ b/src/components/ha-push-notifications-toggle.html @@ -25,7 +25,7 @@ class HaPushNotificationsToggle extends window.hassMixins.EventsMixin(Polymer.El readOnly: true, notify: true, value: ( - 'PushManager' in window && + 'serviceWorker' in navigator && 'PushManager' in window && (document.location.protocol === 'https:' || document.location.hostname === 'localhost' || document.location.hostname === '127.0.0.1') @@ -61,6 +61,7 @@ class HaPushNotificationsToggle extends window.hassMixins.EventsMixin(Polymer.El ); } handlePushChange(pushChecked) { + if (!this.pushSupported) return; if (pushChecked) { this.subscribePushNotifications(); } else {