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 (cherry picked from commit 03b0a5afa60d472dfff160185c493cb94f1e0298)
This commit is contained in:
parent
f8e5a1fb4f
commit
73c25771dc
@ -786,8 +786,9 @@
|
|||||||
return new UAParser(ua, extensions).getResult();
|
return new UAParser(ua, extensions).getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
|
var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined;
|
||||||
var _uach = (typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgentData) ? window.navigator.userAgentData : 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;
|
var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
|
||||||
|
|
||||||
this.getBrowser = function () {
|
this.getBrowser = function () {
|
||||||
@ -795,7 +796,11 @@
|
|||||||
_browser[NAME] = undefined;
|
_browser[NAME] = undefined;
|
||||||
_browser[VERSION] = undefined;
|
_browser[VERSION] = undefined;
|
||||||
rgxMapper.call(_browser, _ua, _rgxmap.browser);
|
rgxMapper.call(_browser, _ua, _rgxmap.browser);
|
||||||
_browser.major = majorize(_browser.version);
|
_browser[MAJOR] = majorize(_browser[VERSION]);
|
||||||
|
// Brave-specific detection
|
||||||
|
if (_navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) {
|
||||||
|
_browser[NAME] = 'Brave';
|
||||||
|
}
|
||||||
return _browser;
|
return _browser;
|
||||||
};
|
};
|
||||||
this.getCPU = function () {
|
this.getCPU = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user