Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isEdge also detects 'Edg' in userAgent. #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dev/getBrowserInfo.js
Original file line number Diff line number Diff line change
@@ -1,11 +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.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:
Expand Down Expand Up @@ -93,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();
}

Expand Down