Skip to content

Commit

Permalink
Various changes to browser detection
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsLeenheer committed Jan 2, 2012
1 parent 81ab8dc commit 268a4c2
Showing 1 changed file with 115 additions and 36 deletions.
151 changes: 115 additions & 36 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -345,46 +345,51 @@ <h3>Development</h3>

var models = {
'Asus': {
'Galaxy6': [ 'Asus', 'Galaxy 6' ]
'Galaxy6': [ 'Asus', 'Galaxy 6' ]
},

'DELL': {
'Venue Pro': [ 'Dell', 'Venue Pro' ]
},

'HTC': {
'7 Mozart': [ 'HTC', '7 Mozart' ],
'HD7 T9292': [ 'HTC', 'HD7' ],
'mwp6985': [ 'HTC', 'Trophy' ],
'Radar 4G': [ 'HTC', 'Radar' ],
'Radar C110e': [ 'HTC', 'Radar' ],
'Mondrian': [ 'HTC', 'Mondrian' ],
'Schubert': [ 'HTC', 'Schubert' ],
'TITAN X310e': [ 'HTC', 'Titan' ]
'7 Mozart': [ 'HTC', '7 Mozart' ],
'7 Mozart T8698': [ 'HTC', '7 Mozart' ],
'HD7 T9292': [ 'HTC', 'HD7' ],
'mwp6985': [ 'HTC', 'Trophy' ],
'Radar 4G': [ 'HTC', 'Radar' ],
'Radar C110e': [ 'HTC', 'Radar' ],
'Mondrian': [ 'HTC', 'Mondrian' ],
'Schubert': [ 'HTC', 'Schubert' ],
'TITAN X310e': [ 'HTC', 'Titan' ]
},

'LG': {
'GW910': [ 'LG', 'Optimus 7' ],
'LG-E900': [ 'LG', 'Optimus 7 E900' ],
'LG-E900h': [ 'LG', 'Optimus 7 E900' ],
'GW910': [ 'LG', 'GW910' ],
'LG-C900k': [ 'LG', 'Quantum' ]
'GW910': [ 'LG', 'Optimus 7' ],
'LG-E900': [ 'LG', 'Optimus 7 E900' ],
'LG-E900h': [ 'LG', 'Optimus 7 E900' ],
'GW910': [ 'LG', 'GW910' ],
'LG-C900k': [ 'LG', 'Quantum' ]
},

'NOKIA': {
'Lumia 710': [ 'Nokia', 'Lumia 710' ],
'Lumia 800': [ 'Nokia', 'Lumia 800' ]
'Lumia 710': [ 'Nokia', 'Lumia 710' ],
'Lumia 800': [ 'Nokia', 'Lumia 800' ]
},

'SAMSUNG': {
'GT-I8350': [ 'Samsung', 'Omnia W' ],
'SGH-i707': [ 'Samsung', 'Taylor' ],
'SGH-i917': [ 'Samsung', 'Omnia 7' ],
'SGH-I917': [ 'Samsung', 'Omnia 7' ],
'SGH-i917R': [ 'Samsung', 'Focus' ],
'SGH-i937': [ 'Samsung', 'Focus S' ],
'OMNIA7': [ 'Samsung', 'Omnia 7' ],
'Taylor': [ 'Samsung', 'Taylor' ]
'GT-I8350': [ 'Samsung', 'Omnia W' ],
'SGH-i707': [ 'Samsung', 'Taylor' ],
'SGH-i917': [ 'Samsung', 'Omnia 7' ],
'SGH-I917': [ 'Samsung', 'Omnia 7' ],
'SGH-i917R': [ 'Samsung', 'Focus' ],
'SGH-i937': [ 'Samsung', 'Focus S' ],
'OMNIA7': [ 'Samsung', 'Omnia 7' ],
'Taylor': [ 'Samsung', 'Taylor' ]
},

'TOSHIBA': {
'TSUNAGI': [ 'Toshiba', 'Tsunagi' ]
'TSUNAGI': [ 'Toshiba', 'Tsunagi' ]
}
}

Expand Down Expand Up @@ -429,9 +434,12 @@ <h3>Development</h3>
'A100': [ 'Acer', 'Iconia Tab A100' ],
'A200': [ 'Acer', 'Iconia Tab A200' ],
'A500': [ 'Acer', 'Iconia Tab A500' ],
'Telenor_OneTouch': [ 'Alcatel', 'OT-990' ],
'one touch 906': [ 'Alcatel', 'One Touch 906' ],
'Telenor_OneTouch': [ 'Alcatel', 'One Touch 990' ],
'Kindle Fire': [ 'Amazon', 'Kindle Fire' ],
'A80KSC': [ 'Archos', 'Arnova 8' ],
'A101B': [ 'Archos', 'Arnova 10' ],
'A70CHT': [ 'Archos', '7C' ],
'ARCHOS 101G9': [ 'Archos', '101 G9' ],
'eeepc': [ 'Asus', 'Eee Pc' ],
'Transformer TF101': [ 'Asus', 'Eee Pad Transformer' ],
Expand All @@ -448,8 +456,10 @@ <h3>Development</h3>
'Dell Streak 7': [ 'Dell', 'Streak 7' ],
'Dell Streak 10 Pro': [ 'Dell', 'Streak 10 Pro' ],
'Tablet-P27': [ 'DracoTek', 'P27 Tablet' ],
'ISW11F': [ 'Fujitsu', 'Arrows Z' ],
'Nexus One': [ 'Google', 'Nexus One' ],
'Nexus S': [ 'Google', 'Nexus S' ],
'Google Nexus S': [ 'Google', 'Nexus S' ],
'Nexus S 4G': [ 'Google', 'Nexus S 4G' ],
'Dooderbutt-4.0.3-v1': [ 'Google', 'Nexus S 4G' ],
'Touchpad': [ 'HP', 'TouchPad' ],
Expand All @@ -461,13 +471,15 @@ <h3>Development</h3>
'HTC_Desire-orange-LS': [ 'HTC', 'Desire' ],
'X06HT': [ 'HTC', 'Desire' ],
'HTC_DesireHD_A9191': [ 'HTC', 'Desire HD' ],
'HTC Desire HD A9191': [ 'HTC', 'Desire HD' ],
'HTC-A9192/1.0': [ 'HTC', 'Desire HD' ],
'Desire HD': [ 'HTC', 'Desire HD' ],
'HTC Desire HD': [ 'HTC', 'Desire HD' ],
'Desire_HD': [ 'HTC', 'Desire HD' ],
'HTC Desire HD with Beats Audio': [ 'HTC', 'Desire HD' ],
'HTC Desire S': [ 'HTC', 'Desire S' ],
'HTC_DesireS_S510e': [ 'HTC', 'Desire S' ],
'HTC_DesireZ_A7272': [ 'HTC', 'Desire Z' ],
'SiRF Dream': [ 'HTC', 'Dream' ],
'HTC Dream': [ 'HTC', 'Dream' ],
'ADR6300': [ 'HTC', 'Droid Incredible' ],
Expand All @@ -480,6 +492,7 @@ <h3>Development</h3>
'PG8610000': [ 'HTC', 'EVO 3D' ],
'Sprint APA9292KT': [ 'HTC', 'EVO 4G' ],
'PC36100': [ 'HTC', 'EVO 4G' ],
'HTC_X515E': [ 'HTC', 'EVO 4G+' ],
'Sprint APA7373KT': [ 'HTC', 'EVO Shift 4G' ],
'HTC Flyer P510e': [ 'HTC', 'Flyer' ],
'HTC Glacier': [ 'HTC', 'Glacier' ],
Expand All @@ -502,11 +515,13 @@ <h3>Development</h3>
'HTC Sensation Z710e': [ 'HTC', 'Sensation' ],
'HTC Sensation Z710E': [ 'HTC', 'Sensation' ],
'HTC_Sensation_Z710e': [ 'HTC', 'Sensation' ],
'HTC Sensation Z715e': [ 'HTC', 'Sensation' ],
'HTC Sensation Z715e': [ 'HTC', 'Sensation XE' ],
'HTC Z710t': [ 'HTC', 'Sensation' ],
'HTC Sensation 4G': [ 'HTC', 'Sensation 4G' ],
'Sensation_4G': [ 'HTC', 'Sensation 4G' ],
'HTC Z715e': [ 'HTC', 'Sensation XE '],
'HTC Z715e': [ 'HTC', 'Sensation XE' ],
'HTC_Z715e': [ 'HTC', 'Sensation XE' ],
'HTC Sensation Z710e with Beats Audio': [ 'HTC', 'Sensation' ],
'HTC Sensation XE with Beats Audio': [ 'HTC', 'Sensation XE' ],
'HTC Sensation XE with Beats Audio Z715e': [ 'HTC', 'Sensation XE' ],
'HTC Sensation XL with Beats Audio X315e': [ 'HTC', 'Sensation XL' ],
Expand All @@ -524,10 +539,12 @@ <h3>Development</h3>
'C8500': [ 'Huawei', 'C8500' ],
'C8600': [ 'Huawei', 'C8600' ],
'c8650': [ 'Huawei', 'C8650' ],
'C8650': [ 'Huawei', 'C8650' ],
'U8110': [ 'Huawei', 'U8110' ],
'U8220': [ 'Huawei', 'U8220' ],
'U8300': [ 'Huawei', 'U8300' ],
'U8350': [ 'Huawei', 'Boulder' ],
'U8180': [ 'Huawei', 'IDEOS X1' ],
'U8500': [ 'Huawei', 'IDEOS X2' ],
'U8510': [ 'Huawei', 'IDEOS X3' ],
'IDEOS S7': [ 'Huawei', 'IDEOS S7' ],
Expand All @@ -539,12 +556,15 @@ <h3>Development</h3>
'U8860': [ 'Huawei', 'Honor' ],
'U9000': [ 'Huawei', 'Ascend X' ],
'HUAWEI MediaPad': [ 'Huawei', 'MediaPad' ],
'HUAWEI_MediaPad': [ 'Huawei', 'MediaPad' ],
'HUAWEI SONIC': [ 'Huawei', 'Sonic' ],
'HUAWEI T8300': [ 'Huawei', 'T8300' ],
'ILT-MX100': [ 'iRiver', 'Tab' ],
'ISW11K': [ 'Kyocera', 'Digno' ],
'A1_07': [ 'Lenovo', 'LePad' ],
'3GW100': [ 'Lenovo', 'LePhone' ],
'3GW101': [ 'Lenovo', 'LePhone' ],
'Lenovo 3GW101': [ 'Lenovo', 'LePhone' ],
'ThinkPad Tablet': [ 'Lenovo', 'ThinkPad Tablet' ],
'Lenovo S1-37AH0': [ 'Lenovo', 'S1-37AH0' ],
'LG-GW620': [ 'LG', 'GW620' ],
Expand All @@ -560,13 +580,16 @@ <h3>Development</h3>
'LG-P698f': [ 'LG', 'Optimus Net' ],
'LG-P720': [ 'LG', 'Optimus Chic' ],
'LG-P920': [ 'LG', 'Optimus 3D' ],
'LG-P930': [ 'LG', 'Nitro HD' ],
'LG-P970': [ 'LG', 'Optimus Black' ],
'LG-P990': [ 'LG', 'Optimus 2X Speed' ],
'Optimus': [ 'LG', 'Optimus' ],
'Optimus 2X': [ 'LG', 'Optimus 2X' ],
'GT540': [ 'LG', 'Optimus GT540' ],
'VM670': [ 'LG', 'Optimus V' ],
'LG-VM670': [ 'LG', 'Optimus V' ],
'LG-P925/V10e': [ 'LG', 'Thrill' ],
'T6': [ 'Malata', 'Zpad T6' ],
'LIFETAB_P9514': [ 'Medion', 'Lifetab' ],
'M9': [ 'Meizu', 'M9' ],
'MEIZU MX': [ 'Meizu', 'MX' ],
Expand All @@ -593,7 +616,9 @@ <h3>Development</h3>
'Motorola XT720': [ 'Motorola', 'Milestone' ],
'ME722': [ 'Motorola', 'Milestone 2' ],
'A953': [ 'Motorola', 'Milestone 2' ],
'MotoA953': [ 'Motorola', 'Milestone 2' ],
'ME525': [ 'Motorola', 'MOTO ME525' ],
'ME525 ': [ 'Motorola', 'MOTO ME525' ],
'MT870': [ 'Motorola', 'MOTO MT870' ],
'XT800': [ 'Motorola', 'MOTO XT800' ],
'XT882': [ 'Motorola', 'MOTO XT882' ],
Expand All @@ -620,6 +645,8 @@ <h3>Development</h3>
'MZ617': [ 'Motorola', 'Droid XYBOARD 10.1' ],
'XT701': [ 'Motorola', 'XT701' ],
'MTC 955': [ 'MTC', '955' ],
'Newpad': [ 'Newsmy', 'Newpad' ],
'Nokia N900': [ 'Nokia', 'N900' ],
'X903': [ 'Oppo', 'X903' ],
'IM-A730s': [ 'Pantech', 'SKY Vega S' ],
'Mobii 7': [ 'Point Of View', 'Mobii 7' ],
Expand All @@ -645,14 +672,17 @@ <h3>Development</h3>
'GT-I9100G': [ 'Samsung', 'Galaxy S II' ],
'GT-I9100M': [ 'Samsung', 'Galaxy S II' ],
'GT-I9100T': [ 'Samsung', 'Galaxy S II' ],
'GT-I9100P': [ 'Samsung', 'Galaxy S II' ],
'GT-I9103': [ 'Samsung', 'Galaxy R' ],
'GT-I9220': [ 'Samsung', 'Galaxy Note' ],
'GT-I9500': [ 'Samsung', 'Galaxy S III' ],
'GT-N7000': [ 'Samsung', 'Galaxy Note' ],
'GT-P1000': [ 'Samsung', 'Galaxy Tab' ],
'GT-P1000L': [ 'Samsung', 'Galaxy Tab' ],
'GT-P6210': [ 'Samsung', 'Galaxy Tab 7.0 Plus'],
'GT-P6800': [ 'Samsung', 'Galaxy Tab 7.7'],
'GT-P6200': [ 'Samsung', 'Galaxy Tab 7.0 Plus' ],
'GT-P6200L': [ 'Samsung', 'Galaxy Tab 7.0 Plus' ],
'GT-P6210': [ 'Samsung', 'Galaxy Tab 7.0 Plus' ],
'GT-P6800': [ 'Samsung', 'Galaxy Tab 7.7' ],
'GT-P7100': [ 'Samsung', 'Galaxy Tab 10.1V' ],
'GT-P7300': [ 'Samsung', 'Galaxy Tab 8.9' ],
'GT-P7310': [ 'Samsung', 'Galaxy Tab 8.9' ],
Expand All @@ -671,6 +701,7 @@ <h3>Development</h3>
'SCH-i569': [ 'Samsung', 'Galaxy Gio' ],
'SCH-I400': [ 'Samsung', 'Continuum' ],
'SCH-I500': [ 'Samsung', 'Fascinate' ],
'SCH-i579': [ 'Samsung', 'Galaxy Ace' ],
'SCH-I909': [ 'Samsung', 'Galaxy S' ],
'SCH-R720': [ 'Samsung', 'Admire' ],
'SGH-I727': [ 'Samsung', 'Galaxy S II Skyrocket' ],
Expand All @@ -686,10 +717,12 @@ <h3>Development</h3>
'SGH-T989': [ 'Samsung', 'Galaxy S II' ],
'SGH-T989D': [ 'Samsung', 'Galaxy S II X' ],
'SHV-E160K': [ 'Samsung', 'Galaxy Note' ],
'SHV-E160S': [ 'Samsung', 'Galaxy Note LTE' ],
'SHW-M110S': [ 'Samsung', 'Galaxy S' ],
'SHW-M130L': [ 'Samsung', 'Galaxy U' ],
'SHW-M130K': [ 'Samsung', 'Galaxy K' ],
'SHW-M250K': [ 'Samsung', 'Galaxy S II' ],
'SHW-M250S': [ 'Samsung', 'Galaxy S II' ],
'SHW-M380S': [ 'Samsung', 'Galaxy Tab 10.1' ],
'SPH-D700': [ 'Samsung', 'Galaxy S Epic 4G' ],
'SPH-D710': [ 'Samsung', 'Galaxy S II Epic 4G' ],
Expand All @@ -709,6 +742,9 @@ <h3>Development</h3>
'SAMSUNG GT-S5830/S5830BUKPE': [ 'Samsung', 'Galaxy Ace' ],
'SAMSUNG GT-S5570/S5570BUKS2': [ 'Samsung', 'Galaxy Mini' ],
'SAMSUNG GT-I9100/I9100BUKG2': [ 'Samsung', 'Galaxy S II' ],
'SAMSUNG GT-I9001/I9001BUKG1': [ 'Samsung', 'Galaxy S Plus' ],
'GT-N7000-ORANGE/N7000XXKKA': [ 'Samsung', 'Galaxy Note' ],
'GT-I9100-ORANGE/I9100BVKJ4': [ 'Samsung', 'Galaxy S II' ],
'SH-03C': [ 'Sharp', 'Lynx 3D' ],
'SH-12C': [ 'Sharp', 'Aquos' ],
'SBM006SH': [ 'Sharp', 'Aquos' ],
Expand All @@ -724,6 +760,7 @@ <h3>Development</h3>
'SonyEricssonMT11iv': [ 'SonyEricsson', 'Xperia Neo V' ],
'SonyEricssonMT15a': [ 'SonyEricsson', 'Xperia Neo' ],
'SonyEricssonMT15i': [ 'SonyEricsson', 'Xperia Neo' ],
'SonyEricssonR800i': [ 'SonyEricsson', 'Xperia Play' ],
'SonyEricssonSK17i': [ 'SonyEricsson', 'Xperia Mini Pro' ],
'SonyEricssonSO-01C': [ 'SonyEricsson', 'Xperia Arc' ],
'SonyEricssonST15i': [ 'SonyEricsson', 'Xperia Mini' ],
Expand All @@ -741,7 +778,9 @@ <h3>Development</h3>
'E15i': [ 'SonyEricsson', 'Xperia X8' ],
'E10i': [ 'SonyEriccson', 'Xperia X10 Mini' ],
'U20i': [ 'SonyEricsson', 'Xperia X10 Mini Pro' ],
'X10i': [ 'SonyEriccson', 'Xperia X10'] ,
'Sony Tablet S': [ 'Sony', 'Tablet S' ],
'P76TI': [ 'Teclast', 'P76Ti' ],
'T-01C': [ 'Toshiba', 'Regza T-01C' ],
'T-01D': [ 'Toshiba', 'Regza T-01D' ],
'AT100': [ 'Toshiba', 'AT100' ],
Expand All @@ -756,7 +795,9 @@ <h3>Development</h3>
'Vodafone 858': [ 'Vodafone', '858 Smart' ],
'WM8650': [ 'WonderMedia', 'WM8650' ],
'MI-ONE Plus': [ 'Xiaomi', 'MI-ONE Plus' ],
'mione_plus': [ 'Xiaomi', 'MI-ONE Plus' ],
'N6': [ 'Yarvik', '210 Tablet' ],
'N50GT': [ 'YuanDao', 'N50GT' ],
'ZTE-T U880': [ 'ZTE', 'Blade' ],
'Blade-opda': [ 'ZTE', 'Blade' ],
'Blade': [ 'ZTE', 'Blade' ],
Expand All @@ -783,7 +824,6 @@ <h3>Development</h3>
detected.os.version = match[2];
}


if (match = /; BlackBerry ([0-9]*);/.exec(ua)) {
detected.device.model = match[1];
}
Expand Down Expand Up @@ -828,10 +868,14 @@ <h3>Development</h3>
'9630': 'Tour'
};

if (typeof models[detected.device.model] != 'undefined') {
detected.device.model = 'BlackBerry ' + models[detected.device.model] + ' ' + detected.device.model;
if (typeof detected.device.model != 'undefined') {
if (typeof models[detected.device.model] != 'undefined') {
detected.device.model = 'BlackBerry ' + models[detected.device.model] + ' ' + detected.device.model;
} else {
detected.device.model = 'BlackBerry ' + detected.device.model;
}
} else {
detected.device.model = 'BlackBerry ' + detected.device.model;
detected.device.model = 'BlackBerry';
}
} else {
detected.device.model = 'BlackBerry';
Expand Down Expand Up @@ -1073,9 +1117,9 @@ <h3>Development</h3>
detected.browser.version = ua.match(/SeaMonkey\/([0-9.]*)/)[1];
}

if (ua.match('Konqueror/')) {
if (ua.match('[k|K]onqueror/')) {
detected.browser.name = 'Konqueror';
detected.browser.version = ua.match(/Konqueror\/([0-9.]*)/)[1];
detected.browser.version = ua.match(/[k|K]onqueror\/([0-9.]*)/)[1];
}

if (ua.match('Chrome')) {
Expand Down Expand Up @@ -1110,11 +1154,21 @@ <h3>Development</h3>
detected.browser.version = ua.match(/QupZilla\/([0-9.]*)/)[1];
}

if (ua.match('MQQBrowser')) {
detected.browser.name = 'QQ Browser';
detected.browser.version = ua.match(/MQQBrowser\/([0-9.]*)/)[1];
}

if (ua.match('Abrowser')) {
detected.browser.name = 'Abrowser';
detected.browser.version = ua.match(/Abrowser\/([0-9.]*)/)[1];
}

if (ua.match('arora')) {
detected.browser.name = 'Arora';
detected.browser.version = ua.match(/arora\/([0-9.]*)/)[1];
}

if (ua.match('Dolfin')) {
detected.browser.name = 'Dolfin';
detected.browser.version = ua.match(/Dolfin\/([0-9]*[.][0-9]*)/)[1];
Expand Down Expand Up @@ -1191,6 +1245,30 @@ <h3>Development</h3>
if (match = /Trident\/([0-9.]*)/.exec(ua)) {
detected.engine.name = 'Trident';
detected.engine.version = match[1];

if (detected.browser.name == 'Internet Explorer') {
if (parseVersion(detected.engine.version) == 6 && parseVersion(detected.browser.version) < 10) {
detected.browser.version = '10.0';
detected.browser.mode = 'compat';
}

if (parseVersion(detected.engine.version) == 5 && parseVersion(detected.browser.version) < 9) {
detected.browser.version = '9.0';
detected.browser.mode = 'compat';
}

if (parseVersion(detected.engine.version) == 4 && parseVersion(detected.browser.version) < 8) {
detected.browser.version = '8.0';
detected.browser.mode = 'compat';
}
}

if (detected.os.name == 'Windows Phone') {
if (parseVersion(detected.engine.version) == 5 && parseVersion(detected.os.version) < 7.5) {
detected.browser.version = '7.5';
detected.browser.mode = 'desktop';
}
}
}


Expand Down Expand Up @@ -1310,6 +1388,7 @@ <h3>Development</h3>
'"bonus": ' + this.results.bonus + ',' +
'"browserName": "' + (Browsers.browser.name ? Browsers.browser.name : '') + '",' +
'"browserVersion": "' + (Browsers.browser.version ? Browsers.browser.version : '') + '",' +
'"browserMode": "' + (Browsers.browser.mode ? Browsers.browser.mode : '') + '",' +
'"engineName": "' + (Browsers.engine.name ? Browsers.engine.name : '') + '",' +
'"engineVersion": "' + (Browsers.engine.version ? Browsers.engine.version : '') + '",' +
'"osName": "' + (Browsers.os.name ? Browsers.os.name : '') + '",' +
Expand Down

0 comments on commit 268a4c2

Please sign in to comment.