mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-28 00:18:45 +03:00
Fix #498 - Detect Brave Browser by checking navigator.brave
https://github.com/brave/brave-browser/issues/10165#issuecomment-641128278
This commit is contained in:
parent
d03c74d6b7
commit
03b0a5afa6
@ -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 () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user