From 5b071ec96af1c9fd04e84fefc6587f27a3feba4c Mon Sep 17 00:00:00 2001 From: Piotr Date: Thu, 31 Aug 2017 16:27:18 +0200 Subject: [PATCH] Fix getBrowser on Chrome for Android On my Android in Chrome(60.0.3112.107) there's no such variable as chrome.runtime, what causes an error. --- BMSPushSDK.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BMSPushSDK.js b/BMSPushSDK.js index 98f438d..e0c2668 100644 --- a/BMSPushSDK.js +++ b/BMSPushSDK.js @@ -288,7 +288,7 @@ function BMSPush() { const SERVICE_WORKER = 'BMSPushServiceWorker.js'; function getBrowser() { - if (window.navigator.userAgent.indexOf("Chrome") != -1 && chrome.runtime.getManifest) { + if (window.navigator.userAgent.indexOf("Chrome") != -1 && chrome.runtime && chrome.runtime.getManifest) { return CHROME_EXTENSION; } let userAgentOfBrowser = navigator.userAgent.toLowerCase();