|
803 | 803 | var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY);
|
804 | 804 | var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined;
|
805 | 805 | var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
|
| 806 | + var _isSelfNav = _navigator && _navigator.userAgent == _ua; |
806 | 807 |
|
807 | 808 | this.getBrowser = function () {
|
808 | 809 | var _browser = {};
|
|
811 | 812 | rgxMapper.call(_browser, _ua, _rgxmap.browser);
|
812 | 813 | _browser[MAJOR] = majorize(_browser[VERSION]);
|
813 | 814 | // Brave-specific detection
|
814 |
| - if (_navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) { |
| 815 | + if (_isSelfNav && _navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) { |
815 | 816 | _browser[NAME] = 'Brave';
|
816 | 817 | }
|
817 | 818 | return _browser;
|
|
828 | 829 | _device[MODEL] = undefined;
|
829 | 830 | _device[TYPE] = undefined;
|
830 | 831 | rgxMapper.call(_device, _ua, _rgxmap.device);
|
831 |
| - if (!_device[TYPE] && _uach && _uach.mobile) { |
| 832 | + if (_isSelfNav && !_device[TYPE] && _uach && _uach.mobile) { |
832 | 833 | _device[TYPE] = MOBILE;
|
833 | 834 | }
|
834 | 835 | // iPadOS-specific detection: identified as Mac, but has some iOS-only properties
|
835 |
| - if (_device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) { |
| 836 | + if (_isSelfNav && _device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) { |
836 | 837 | _device[MODEL] = 'iPad';
|
837 | 838 | _device[TYPE] = TABLET;
|
838 | 839 | }
|
|
850 | 851 | _os[NAME] = undefined;
|
851 | 852 | _os[VERSION] = undefined;
|
852 | 853 | rgxMapper.call(_os, _ua, _rgxmap.os);
|
853 |
| - if (!_os[NAME] && _uach && _uach.platform != 'Unknown') { |
| 854 | + if (_isSelfNav && !_os[NAME] && _uach && _uach.platform != 'Unknown') { |
854 | 855 | _os[NAME] = _uach.platform
|
855 | 856 | .replace(/chrome os/i, CHROMIUM_OS)
|
856 | 857 | .replace(/macos/i, MAC_OS); // backward compatibility
|
|
0 commit comments