Browser
The Browser
object of the BrowserManager
class provides methods for determining the type of browser, Internet Explorer version, operating system, and other device characteristics such as touch input support and screen resolution.
import { Browser, LoggerBrowser } from '@bitrix24/b24jssdk'
const $logger = LoggerBrowser.build('Test', import.meta.env?.DEV === true)
$logger.info('isTouchDevice:', Browser.isTouchDevice())
// isTouchDevice: false ////
It uses
navigator.userAgent
to determine browser and device characteristics.
Methods
isOpera
isOpera(): boolean
Returns true
if the current browser is Opera.
isIE
isIE(): boolean
Returns true
if the current browser is Internet Explorer.
isIE6
isIE6(): boolean
Returns true
if the current browser is Internet Explorer version 6.
isIE7
isIE7(): boolean
Returns true
if the current browser is Internet Explorer version 7.
isIE8
isIE8(): boolean
Returns true
if the current browser is Internet Explorer version 8.
isIE9
isIE9(): boolean
Returns true
if the current browser is Internet Explorer version 9.
isIE10
isIE10(): boolean
Returns true
if the current browser is Internet Explorer version 10.
isSafari
isSafari(): boolean
Returns true
if the current browser is Safari.
isFirefox
isFirefox(): boolean
Returns true
if the current browser is Firefox.
isChrome
isChrome(): boolean
Returns true
if the current browser is Chrome.
detectIEVersion
detectIEVersion(): number
Returns the version of Internet Explorer or -1 if the browser is not IE.
isIE11
isIE11(): boolean
Returns true
if the current browser is Internet Explorer version 11.
isMac
isMac(): boolean
Returns true
if the operating system is MacOS.
isWin
isWin(): boolean
Returns true
if the operating system is Windows.
isLinux
isLinux(): boolean
Returns true
if the operating system is Linux and not Android.
isAndroid
isAndroid(): boolean
Returns true
if the device is running on Android.
isIPad
isIPad(): boolean
Returns true
if the device is an iPad.
isIPhone
isIPhone(): boolean
Returns true
if the device is an iPhone.
isIOS
isIOS(): boolean
Returns true
if the device is running on iOS (iPad or iPhone).
isMobile
isMobile(): boolean
Returns true
if the device is mobile.
isRetina
isRetina(): boolean
Returns true
if the device has a Retina display.
isTouchDevice
isTouchDevice(): boolean
Returns true
if the device supports touch input.
isDoctype
isDoctype(target: any): boolean
Returns true
if the document has a CSS1Compat
compatibility mode.
isLocalStorageSupported
isLocalStorageSupported(): boolean
Returns true
if local storage is supported and available.
detectAndroidVersion
detectAndroidVersion(): number
Returns the version of Android or 0 if the device is not Android.