diff --git a/lib/detectBrowser.js b/lib/detectBrowser.js index 0b33082..e2505f9 100644 --- a/lib/detectBrowser.js +++ b/lib/detectBrowser.js @@ -2,6 +2,7 @@ module.exports = function detectBrowser(userAgentString) { var browsers = [ [ 'edge', /Edge\/([0-9\._]+)/ ], [ 'chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/ ], + [ 'crios', /CriOS\/([0-9\.]+)(:?\s|$)/ ], [ 'firefox', /Firefox\/([0-9\.]+)(?:\s|$)/ ], [ 'opera', /Opera\/([0-9\.]+)(?:\s|$)/ ], [ 'opera', /OPR\/([0-9\.]+)(:?\s|$)$/ ], diff --git a/test/logic.js b/test/logic.js index 560266e..cb60325 100644 --- a/test/logic.js +++ b/test/logic.js @@ -19,6 +19,15 @@ test('detects Chrome', function(t) { t.end(); }); +test('detects Chrome for iOS', function(t) { + assertAgentString(t, + 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3', + { name: 'crios', version: '19.0.1084' } + ); + + t.end(); +}); + test('detects Firefox', function(t) { assertAgentString(t, 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0',