Class BrowserInfo


  • public class BrowserInfo
    extends Object
    Provides a way to query information about web browser. Browser details are detected only once and those are stored in this singleton class.
    Since:
    1.0
    • Method Detail

      • get

        public static BrowserInfo get()
        Singleton method to get BrowserInfo object.
        Returns:
        instance of BrowserInfo object
      • isIE

        public boolean isIE()
        Checks if the browser is IE.
        Returns:
        true if the browser is IE, false otherwise
      • isEdge

        public boolean isEdge()
        Checks if the browser is Edge.
        Returns:
        true if the browser is Edge, false otherwise
      • isFirefox

        public boolean isFirefox()
        Checks if the browser is Firefox.
        Returns:
        true if the browser is Firefox, false otherwise
      • isSafari

        public boolean isSafari()
        Checks if the browser is Safari.
        Returns:
        true if the browser is Safari, false otherwise
      • isSafariOrIOS

        public boolean isSafariOrIOS()
        Checks if the browser is Safari or runs on IOS (covering also Chrome on iOS).
        Returns:
        true if the browser is Safari or running on IOS, false otherwise
      • isChrome

        public boolean isChrome()
        Checks if the browser is Chrome.
        Returns:
        true if the browser is Chrome, false otherwise
      • isGecko

        public boolean isGecko()
        Checks if the browser using the Gecko engine.
        Returns:
        true if the browser is using Gecko, false otherwise
      • isWebkit

        public boolean isWebkit()
        Checks if the browser using the Webkit engine.
        Returns:
        true if the browser is using Webkit, false otherwise
      • getGeckoVersion

        public float getGeckoVersion()
        Returns the Gecko version if the browser is Gecko based. The Gecko version for Firefox 2 is 1.8 and 1.9 for Firefox 3.
        Returns:
        The Gecko version or -1 if the browser is not Gecko based
      • getWebkitVersion

        public float getWebkitVersion()
        Returns the WebKit version if the browser is WebKit based. The WebKit version returned is the major version e.g., 523.
        Returns:
        The WebKit version or -1 if the browser is not WebKit based
      • isOpera

        public boolean isOpera()
        Checks if the browser is Opera.
        Returns:
        true if the browser is Opera, false otherwise
      • isTouchDevice

        public boolean isTouchDevice()
        Checks if the browser runs on a touch capable device.
        Returns:
        true if the browser runs on a touch based device, false otherwise
      • isAndroid

        public boolean isAndroid()
        Checks if the browser is run on Android.
        Returns:
        true if the browser is run on Android, false otherwise
      • isAndroidWithBrokenScrollTop

        public boolean isAndroidWithBrokenScrollTop()
        Tests if this is an Android devices with a broken scrollTop implementation.
        Returns:
        true if scrollTop cannot be trusted on this device, false otherwise
      • getBrowserMajorVersion

        public int getBrowserMajorVersion()
        Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome 4, 8 for Internet Explorer 8.

        Note that Internet Explorer 8 and newer will return the document mode so IE8 rendering as IE7 will return 7.

        Returns:
        The major version of the browser.
      • getBrowserMinorVersion

        public int getBrowserMinorVersion()
        Returns the browser minor version e.g., 5 for Firefox 3.5.
        Returns:
        The minor version of the browser, or -1 if not known/parsed.
        See Also:
        getBrowserMajorVersion()