From c7778c550e9e75381f72e5a8872c47e77052f421 Mon Sep 17 00:00:00 2001 From: devel-pa Date: Wed, 24 Aug 2016 18:30:09 +0200 Subject: [PATCH 1/9] Act safe in case navigator doesn't have a userAgent. --- src/bowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 676a64a..a6059c2 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -395,7 +395,7 @@ return result } - var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '') + var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '') bowser.test = function (browserList) { for (var i = 0; i < browserList.length; ++i) { From 973718f851bd395b449eef2a7c8af99b09f8163e Mon Sep 17 00:00:00 2001 From: Jeffrey Bouva Date: Thu, 25 Aug 2016 14:01:03 +0200 Subject: [PATCH 2/9] Consistent use of bowser variable --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0386ff3..d8f3e48 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ We don't save built script in the repo anymore. The main file (`src/bowser.js`) Also you can download minified file from [the release page](https://github.com/ded/bowser/releases). ## 1.0.0 breaking changes -`browser = require('bowser').browser;` becomes `browser = require('bowser');` +`bowser = require('bowser').bowser;` becomes `bowser = require('bowser');` --- @@ -32,7 +32,7 @@ Use it to get object with detected flags from User Agent string. Use it to check if browser supported. ``` -browser.check({msie: "11"}, window.navigator.userAgent); +bowser.check({msie: "11"}, window.navigator.userAgent); // true / false ``` @@ -40,7 +40,7 @@ browser.check({msie: "11"}, window.navigator.userAgent); Use it to compare two versions. ``` -browser.compareVersions(['9.0', '10']); +bowser.compareVersions(['9.0', '10']); // -1 ``` @@ -48,7 +48,7 @@ browser.compareVersions(['9.0', '10']); Use it to check if browser is unsupported. ``` -browser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent); +bowser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent); // true / false ``` From b9d0ed6fd85ce2f18d1cb01124cc6cb310eff782 Mon Sep 17 00:00:00 2001 From: Erik Bengtsson Date: Sat, 27 Aug 2016 12:22:38 -0400 Subject: [PATCH 3/9] Added support for Samsung Internet for Android --- src/bowser.js | 9 +++++++++ src/useragents.js | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/bowser.js b/src/bowser.js index 676a64a..98b3de6 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -38,6 +38,7 @@ , tizen = /tizen/i.test(ua) , webos = /(web|hpw)os/i.test(ua) , windowsphone = /windows phone/i.test(ua) + , samsungBrowser = /SamsungBrowser/i.test(ua) , windows = !windowsphone && /windows/i.test(ua) , mac = !iosdevice && !silk && /macintosh/i.test(ua) , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) @@ -55,6 +56,13 @@ , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i) } } + else if (/SamsungBrowser/i.test(ua)) { + result = { + name: 'Samsung Internet for Android' + , samsungBrowser: t + , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i) + } + } else if (/coast/i.test(ua)) { result = { name: 'Opera Coast' @@ -372,6 +380,7 @@ (result.yandexbrowser && result.version >= 15) || (result.vivaldi && result.version >= 1.0) || (result.chrome && result.version >= 20) || + (result.samsungBrowser && result.version >= 4) || (result.firefox && result.version >= 20.0) || (result.safari && result.version >= 6) || (result.opera && result.version >= 10.0) || diff --git a/src/useragents.js b/src/useragents.js index dd7fb25..2303d08 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -1264,4 +1264,15 @@ module.exports.useragents = { , x: true } } + , 'Samsung Internet for Android' : { + 'Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-G925F Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari/537.36': { + mobile: true + , android: true + , osversion: '5.0.2' + , samsungBrowser: true + , version: '4.0' + , a: true + , blink: true + } + } } From 7a8b91dc6f6bd3527edfbff29e5c3bdde96f02b7 Mon Sep 17 00:00:00 2001 From: kerbyfc Date: Mon, 29 Aug 2016 12:59:58 +0300 Subject: [PATCH 4/9] Improve the browser.check documentation --- README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0386ff3..5cf1a5f 100644 --- a/README.md +++ b/README.md @@ -28,18 +28,31 @@ Use it to get object with detected flags of your current browser. ### bowser._detect(ua `:String`)`:Object` Use it to get object with detected flags from User Agent string. -### bowser.check(minVersions`:Object`, strictMode`:Boolean`, [ua]`:String`)`:Boolean` +### bowser.check(minVersions`:Object`, [strictMode]`:Boolean`, [ua]`:String`)`:Boolean` Use it to check if browser supported. -``` -browser.check({msie: "11"}, window.navigator.userAgent); -// true / false +``` js +/** + * in case of using IE10 + */ +browser.check({msie: "11"}); // true +browser.check({msie: "9.0"}); // false + +/** + * specific user agent + */ +browser.check({chome: 45}, window.navigator.userAgent); // true + +/** + * but false in strict mode + */ +browesr.check({chome: 45}, true, window.navigator.userAgent); // false ``` ### bowser.compareVersions(versions`:Array`)`:Number` Use it to compare two versions. -``` +``` js browser.compareVersions(['9.0', '10']); // -1 ``` @@ -47,7 +60,7 @@ browser.compareVersions(['9.0', '10']); ### bowser.isUnsupportedBrowser(minVersions`:Object`, [strictMode]`:Boolean`, [ua]`:string`)`:Boolean` Use it to check if browser is unsupported. -``` +``` js browser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent); // true / false ``` From 62ae9d6cbf8c73d4cde29765a8136fc42c7fd1c7 Mon Sep 17 00:00:00 2001 From: kerbyfc Date: Mon, 29 Aug 2016 13:02:00 +0300 Subject: [PATCH 5/9] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5cf1a5f..baf21f9 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ browser.check({chome: 45}, window.navigator.userAgent); // true /** * but false in strict mode */ -browesr.check({chome: 45}, true, window.navigator.userAgent); // false +browser.check({chome: 45}, true, window.navigator.userAgent); // false ``` ### bowser.compareVersions(versions`:Array`)`:Number` From ab028b2529ede51229da0bba276ea8b62f0c0224 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Tue, 30 Aug 2016 00:00:14 +0300 Subject: [PATCH 6/9] fix typo in the README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chome → chrome --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index baf21f9..ddcf1d1 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,12 @@ browser.check({msie: "9.0"}); // false /** * specific user agent */ -browser.check({chome: 45}, window.navigator.userAgent); // true +browser.check({chrome: 45}, window.navigator.userAgent); // true /** * but false in strict mode */ -browser.check({chome: 45}, true, window.navigator.userAgent); // false +browser.check({chrome: 45}, true, window.navigator.userAgent); // false ``` ### bowser.compareVersions(versions`:Array`)`:Number` From 034818f470c2173082762f494d0291bed923aa00 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Tue, 30 Aug 2016 00:18:27 +0300 Subject: [PATCH 7/9] add support of samsungBrowser to the docs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e5e3171..f17f21a 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ If detected, one of these flags may be set to true. The rendering engine flag i * `android` - native browser - [`webkit`|`blink`] * `ios` - native browser - [`webkit`] * `opera` - [`blink` if >=15] + * `samsungBrowser` - [`blink`] * `phantom` - [`webkit`] * `blackberry` - native browser - [`webkit`] * `webos` - native browser - [`webkit`] From 87fd1551b51c42ef1c0aaebc694f5c581a5b7758 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Tue, 30 Aug 2016 00:20:37 +0300 Subject: [PATCH 8/9] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b9e55a..0eb3878 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "sniff", "detection" ], - "version": "1.4.4", + "version": "1.4.5", "homepage": "https://github.com/ded/bowser", "author": "Dustin Diaz (http://dustindiaz.com)", "main": "./src/bowser.js", From 89b3e239db4d128443e4a8b74df440f5f9214f35 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Tue, 30 Aug 2016 00:25:54 +0300 Subject: [PATCH 9/9] write changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dae197..db71c87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Bowser Changelog +### 1.4.5 (August 30, 2016) + +- [FIX] Add support of Samsung Internet for Android +- [FIX] Fix case when `navigator.userAgent` is `undefined` +- [DOC] Add information about `strictMode` in `check` function +- [DOC] Consistent use of `bowser` variable in the README + ### 1.4.4 (August 10, 2016) - [FIX] Fix AMD `define` call — pass name to the function