diff --git a/README.md b/README.md index 4585f43..7c72c5c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ if (bowser.msie && bowser.version <= 6) { * Bada browser as `bada`[`webkit`] * Tizen browser as `tizen`[`webkit`] * Sailfish browser as `sailfish`[`gecko`] + * Vivaldi browser as `vivaldi`[`webkit`] For all detected browsers the browser version is set in the `version` field. diff --git a/src/bowser.js b/src/bowser.js index cefeee2..1a2208f 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -65,14 +65,23 @@ , msie: t , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) } - } else if (chromeBook) { + } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier + } + } + else if (chromeBook) { result = { name: 'Chrome' , chromeBook: t , chrome: t , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) } - } else if (/chrome.+? edge/i.test(ua)) { + } + else if (/chrome.+? edge/i.test(ua)) { result = { name: 'Microsoft Edge' , msedge: t @@ -241,6 +250,7 @@ (result.chrome && result.version >= 20) || (result.firefox && result.version >= 20.0) || (result.safari && result.version >= 6) || + (result.vivaldi && result.version >= 1) || (result.opera && result.version >= 10.0) || (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || (result.blackberry && result.version >= 10.1) diff --git a/src/useragents.js b/src/useragents.js index 9a4263a..602d17d 100644 --- a/src/useragents.js +++ b/src/useragents.js @@ -964,6 +964,20 @@ module.exports.useragents = { , x: true } } + , Vivaldi: { + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.303.52': { + vivaldi: true, + version: '1.0', + webkit: true, + a: true + }, + 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36 Vivaldi/1.0.303.52': { + vivaldi: true, + version: '1.0', + webkit: true, + a: true + } + } , Generic: { 'Generic/2.15 libww': { name: 'Generic'