From afbdc6848df35a37935c79e0efa460e82677ef67 Mon Sep 17 00:00:00 2001 From: John Rizzo <83981217+johnrizzo4@users.noreply.github.com> Date: Mon, 13 Feb 2023 06:19:12 +0100 Subject: [PATCH 1/2] isEdge also detects 'Edg' in userAgent. --- dev/getBrowserInfo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/getBrowserInfo.js b/dev/getBrowserInfo.js index a2618aa..6419a8e 100644 --- a/dev/getBrowserInfo.js +++ b/dev/getBrowserInfo.js @@ -1,6 +1,7 @@ var isMobileDevice = !!(/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(navigator.userAgent || '')); -var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob); +var isEdge = (navigator.userAgent.indexOf('Edge') !== -1 || navigator.userAgent.indexOf('Edg') !== -1) // Microsoft replaced 'Edge' by 'Edg' a while ago to avoid confusion with a legacy Edge browser. + && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob); var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && ('netscape' in window) && / rv:/.test(navigator.userAgent); From 7b515fa77cbfd920aedd55f93dc56e4de5f882c4 Mon Sep 17 00:00:00 2001 From: John Rizzo <83981217+johnrizzo4@users.noreply.github.com> Date: Sat, 18 Feb 2023 19:01:06 +0100 Subject: [PATCH 2/2] Update getBrowserInfo.js for Edge. --- dev/getBrowserInfo.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/getBrowserInfo.js b/dev/getBrowserInfo.js index 6419a8e..c78b9ff 100644 --- a/dev/getBrowserInfo.js +++ b/dev/getBrowserInfo.js @@ -1,12 +1,12 @@ var isMobileDevice = !!(/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(navigator.userAgent || '')); -var isEdge = (navigator.userAgent.indexOf('Edge') !== -1 || navigator.userAgent.indexOf('Edg') !== -1) // Microsoft replaced 'Edge' by 'Edg' a while ago to avoid confusion with a legacy Edge browser. - && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob); +var isEdge = (navigator.userAgent.indexOf('Edge') !== -1 || navigator.userAgent.indexOf('Edg') !== -1); // Microsoft replaced 'Edge' by 'Edg' a while ago to avoid confusion with a legacy Edge browser. + // && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob); commented out 2023-02-18: who has written this and why? Is it still needed? var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && ('netscape' in window) && / rv:/.test(navigator.userAgent); var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); -var isChrome = !!window.chrome && !isOpera; +var isChrome = !!window.chrome && !isEdge && !isOpera; var isIE = typeof document !== 'undefined' && !!document.documentMode && !isEdge; // this one can also be used: @@ -94,7 +94,7 @@ function getBrowserInfo() { if (isEdge) { browserName = 'Edge'; - fullVersion = navigator.userAgent.split('Edge/')[1]; + fullVersion = navigator.userAgent.split(/Edge?\//)[1]; // fullVersion = parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10).toString(); }