diff --git a/src/ua-parser.js b/src/ua-parser.js index 18ac0f6f1..71a5c9208 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -860,8 +860,9 @@ return new UAParser(ua, extensions).getResult(); } - var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); - var _uach = (typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgentData) ? window.navigator.userAgentData : undefined; + var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined; + var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY); + var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined; var _rgxmap = extensions ? extend(regexes, extensions) : regexes; // public methods @@ -869,6 +870,10 @@ var _browser = new UABrowser(); rgxMapper.call(_browser, _ua, _rgxmap.browser); _browser[MAJOR] = majorize(_browser[VERSION]); + // Brave-specific detection + if (_navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) { + _browser[NAME] = 'Brave'; + } return _browser; }; this.getCPU = function () {