public class BrowserInfo extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ENGINE_GECKO |
static String |
ENGINE_PRESTO |
static String |
ENGINE_TRIDENT |
static String |
ENGINE_WEBKIT |
Modifier and Type | Method and Description |
---|---|
static BrowserInfo |
get()
Singleton method to get BrowserInfo object.
|
int |
getBrowserMajorVersion()
Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome
4, 8 for Internet Explorer 8.
|
int |
getBrowserMinorVersion()
Returns the browser minor version e.g., 5 for Firefox 3.5.
|
static String |
getBrowserString() |
String |
getCSSClass()
Returns a string representing the browser in use, for use in CSS
classnames.
|
float |
getGeckoVersion()
Returns the Gecko version if the browser is Gecko based.
|
float |
getIEVersion() |
float |
getOperaVersion() |
int |
getScreenHeight() |
int |
getScreenWidth() |
float |
getWebkitVersion()
Returns the WebKit version if the browser is WebKit based.
|
boolean |
isAndroid()
Checks if the browser is run on Android
|
boolean |
isAndroid23() |
boolean |
isAndroidWithBrokenScrollTop()
Tests if this is an Android devices with a broken scrollTop
implementation
|
boolean |
isBrowserVersionNewerOrEqual(int majorVersion,
int minorVersion)
Checks if the browser version is newer or equal to the given major+minor
version.
|
boolean |
isChrome() |
boolean |
isEdge() |
boolean |
isFirefox() |
boolean |
isGecko() |
boolean |
isIE() |
boolean |
isIE10() |
boolean |
isIE11() |
boolean |
isIE8() |
boolean |
isIE9() |
boolean |
isIOS()
Checks if the browser is run on iOS
|
boolean |
isIOS6()
Checks if the browser is run on iOS 6.
|
boolean |
isOpera() |
boolean |
isOpera10() |
boolean |
isOpera11() |
boolean |
isSafari() |
boolean |
isTouchDevice() |
boolean |
isWebkit() |
boolean |
requiresOverflowAutoFix()
Indicates whether the browser might require juggling to properly update
sizes inside elements with overflow: auto.
|
boolean |
requiresPositionAbsoluteOverflowAutoFix()
Indicates whether the browser might require juggling to properly update
sizes inside elements with overflow: auto when adjusting absolutely
positioned elements.
|
boolean |
requiresTouchScrollDelegate()
Checks if the browser is capable of handling scrolling natively or if a
touch scroll helper is needed for scrolling.
|
public static final String ENGINE_GECKO
public static final String ENGINE_WEBKIT
public static final String ENGINE_PRESTO
public static final String ENGINE_TRIDENT
public static BrowserInfo get()
public String getCSSClass()
public boolean isIE()
public boolean isEdge()
public boolean isFirefox()
public boolean isSafari()
public boolean isIE8()
public boolean isIE9()
public boolean isIE10()
public boolean isIE11()
public boolean isChrome()
public boolean isGecko()
public boolean isWebkit()
public float getGeckoVersion()
public float getWebkitVersion()
public float getIEVersion()
public float getOperaVersion()
public boolean isOpera()
public boolean isOpera10()
public boolean isOpera11()
public static String getBrowserString()
public int getScreenWidth()
public int getScreenHeight()
public boolean isTouchDevice()
public boolean requiresOverflowAutoFix()
true
if the browser requires the workaround,
otherwise false
public boolean requiresPositionAbsoluteOverflowAutoFix()
See https://bugs.webkit.org/show_bug.cgi?id=123958 and http://code.google.com/p/chromium/issues/detail?id=316549
true
if the browser requires the workaround,
otherwise false
public boolean isIOS()
public boolean isIOS6()
public boolean isAndroid()
public boolean requiresTouchScrollDelegate()
public boolean isAndroidWithBrokenScrollTop()
public boolean isAndroid23()
public int getBrowserMajorVersion()
Note that Internet Explorer 8 and newer will return the document mode so IE8 rendering as IE7 will return 7.
public int getBrowserMinorVersion()
getBrowserMajorVersion()
public boolean isBrowserVersionNewerOrEqual(int majorVersion, int minorVersion)
majorVersion
- The major version to check forminorVersion
- The minor version to check forCopyright © 2019 Vaadin Ltd. All rights reserved.