Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 49e1722

Browse files
committed
Add support for IE 11 masking as other browsers.
Closes #57.
1 parent c884d39 commit 49e1722

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

platform.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@
711711
description.unshift('desktop mode');
712712
version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
713713
}
714-
// Detect IE 11.
714+
// Detect IE 11 identifying as other browsers.
715715
else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
716716
if (name) {
717717
description.push('identifying as ' + name + (version ? ' ' + version : ''));
@@ -776,6 +776,14 @@
776776
}
777777
version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
778778
}
779+
// Detect IE 11 masking as other browsers.
780+
else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
781+
description.push('masking as ' + name + ' ' + version);
782+
name = 'IE';
783+
version = '11.0';
784+
layout = ['Trident'];
785+
os = 'Windows';
786+
}
779787
os = os && format(os);
780788
}
781789
// Detect prerelease phases.

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,24 @@
13111311
'version': '11.0'
13121312
},
13131313

1314+
'IE 11.0 (masking as Chrome 28.0.1500.95) on Windows': {
1315+
'ua': 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36',
1316+
'layout': 'Trident',
1317+
'mode': 11,
1318+
'name': 'IE',
1319+
'os': 'Windows',
1320+
'version': '11.0'
1321+
},
1322+
1323+
'IE 11.0 (masking as Firefox 12.0) on Windows': {
1324+
'ua': 'Mozilla/5.0 (Windows NT 6.2; rv:12.0) Gecko/20100101 Firefox/12.0',
1325+
'layout': 'Trident',
1326+
'mode': 11,
1327+
'name': 'IE',
1328+
'os': 'Windows',
1329+
'version': '11.0'
1330+
},
1331+
13141332
'IE Mobile 4.01 on Windows CE': {
13151333
'ua' : 'Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)',
13161334
'layout': 'Trident',

0 commit comments

Comments
 (0)