1// Modified version of https://github.com/DamonOehlman/detect-browser to work with non compiler 2var detectBrowser = function detectBrowser(userAgentString) { 3 if (!userAgentString) return null; 4 5 var browsers = [ 6 [ 'edge', /Edge\/([0-9\._]+)/ ], 7 [ 'yandexbrowser', /YaBrowser\/([0-9\._]+)/ ], 8 [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ ], 9 [ 'crios', /CriOS\/([0-9\.]+)(:?\s|$)/ ], 10 [ 'firefox', /Firefox\/([0-9\.]+)(?:\s|$)/ ], 11 [ 'opera', /Opera\/([0-9\.]+)(?:\s|$)/ ], 12 [ 'opera', /OPR\/([0-9\.]+)(:?\s|$)$/ ], 13 [ 'ie', /Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/ ], 14 [ 'ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/ ], 15 [ 'ie', /MSIE\s(7\.0)/ ], 16 [ 'bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/ ], 17 [ 'android', /Android\s([0-9\.]+)/ ], 18 [ 'ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/ ], 19 [ 'safari', /Version\/([0-9\._]+).*Safari/ ] 20 ]; 21 22 return browsers.map(function (rule) { 23 if (rule[1].test(userAgentString)) { 24 var match = rule[1].exec(userAgentString); 25 var version = match && match[1].split(/[._]/).slice(0,3); 26 27 if (version && version.length < 3) { 28 Array.prototype.push.apply(version, (version.length == 1) ? [0, 0] : [0]); 29 } 30 31 return { 32 name: rule[0], 33 version: version.join('.') 34 }; 35 } 36 }).filter(Boolean).shift(); 37}; 38 39var agent; 40 41if (typeof navigator !== 'undefined' && navigator) { 42 agent = navigator.userAgent; 43} 44 45browser = detectBrowser(agent);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.