Package com.vaadin.shared
Class VBrowserDetails
- java.lang.Object
-
- com.vaadin.shared.VBrowserDetails
-
- All Implemented Interfaces:
Serializable
public class VBrowserDetails extends Object implements Serializable
Class that parses the user agent string from the browser and provides information about the browser. Used internally bycom.vaadin.client.BrowserInfoandcom.vaadin.server.WebBrowser. Should not be used directly.- Since:
- 6.3
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVBrowserDetails.OperatingSystem
-
Constructor Summary
Constructors Constructor Description VBrowserDetails(String userAgent)Create an instance based on the given user agent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetBrowserEngineVersion()Returns the version of the browser engine.intgetBrowserMajorVersion()Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome 4, 8 for Internet Explorer 8.intgetBrowserMinorVersion()Returns the browser minor version e.g., 5 for Firefox 3.5.intgetOperatingSystemMajorVersion()Returns the major version of the operating system.intgetOperatingSystemMinorVersion()Returns the minor version of the operating system.booleanisAndroid()Tests if the browser is run on Android.booleanisChrome()Tests if the browser is Chrome.booleanisChromeFrame()Tests if the browser is running ChromeFrame.booleanisChromeFrameCapable()Tests if the browser is capable of running ChromeFrame.booleanisEdge()Tests if the browser is Edge.booleanisFirefox()Tests if the browser is Firefox.booleanisGecko()Tests if the browser is using the Gecko enginebooleanisIE()Tests if the browser is Internet Explorer.booleanisIOS()Tests if the browser is run in iOS.booleanisIPad()Tests if the browser is run on iPad.booleanisIPhone()Tests if the browser is run on iPhone.booleanisLinux()Tests if the browser is run on Linux.booleanisMacOSX()Tests if the browser is run on Mac OSX.booleanisOpera()Tests if the browser is Opera.booleanisPhantomJS()Tests if the browser is PhantomJS.booleanisPresto()Tests if the browser is using the Presto enginebooleanisSafari()Tests if the browser is Safari.booleanisTooOldToFunctionProperly()Checks if the browser is so old that it simply won't work with a Vaadin application.booleanisTrident()Tests if the browser is using the Trident enginebooleanisWebKit()Tests if the browser is using the WebKit enginebooleanisWindows()Tests if the browser is run on Windows.booleanisWindowsPhone()Tests if the browser is run on Windows Phone.voidsetIEMode(int documentMode)Sets the version for IE based on the documentMode.
-
-
-
Constructor Detail
-
VBrowserDetails
public VBrowserDetails(String userAgent)
Create an instance based on the given user agent.- Parameters:
userAgent- User agent as provided by the browser.
-
-
Method Detail
-
isFirefox
public boolean isFirefox()
Tests if the browser is Firefox.- Returns:
- true if it is Firefox, false otherwise
-
isGecko
public boolean isGecko()
Tests if the browser is using the Gecko engine- Returns:
- true if it is Gecko, false otherwise
-
isWebKit
public boolean isWebKit()
Tests if the browser is using the WebKit engine- Returns:
- true if it is WebKit, false otherwise
-
isPresto
public boolean isPresto()
Tests if the browser is using the Presto engine- Returns:
- true if it is Presto, false otherwise
-
isTrident
public boolean isTrident()
Tests if the browser is using the Trident engine- Returns:
- true if it is Trident, false otherwise
- Since:
- 7.1.7
-
isSafari
public boolean isSafari()
Tests if the browser is Safari.- Returns:
- true if it is Safari, false otherwise
-
isChrome
public boolean isChrome()
Tests if the browser is Chrome.- Returns:
- true if it is Chrome, false otherwise
-
isChromeFrameCapable
public boolean isChromeFrameCapable()
Tests if the browser is capable of running ChromeFrame.- Returns:
- true if it has ChromeFrame, false otherwise
-
isChromeFrame
public boolean isChromeFrame()
Tests if the browser is running ChromeFrame.- Returns:
- true if it is ChromeFrame, false otherwise
-
isOpera
public boolean isOpera()
Tests if the browser is Opera.- Returns:
- true if it is Opera, false otherwise
-
isIE
public boolean isIE()
Tests if the browser is Internet Explorer.- Returns:
- true if it is Internet Explorer, false otherwise
-
isEdge
public boolean isEdge()
Tests if the browser is Edge.- Returns:
- true if it is Edge, false otherwise
- Since:
- 7.5.3
-
isPhantomJS
public boolean isPhantomJS()
Tests if the browser is PhantomJS.- Returns:
- true if it is PhantomJS, false otherwise
-
getBrowserEngineVersion
public float getBrowserEngineVersion()
Returns the version of the browser engine. For WebKit this is an integer e.g., 532.0. For gecko it is a float e.g., 1.8 or 1.9.- Returns:
- The version of the browser engine
-
getBrowserMajorVersion
public final 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 final 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()
-
setIEMode
public void setIEMode(int documentMode)
Sets the version for IE based on the documentMode. This is used to return the correct the correct IE version when the version from the user agent string and the value of the documentMode property do not match.- Parameters:
documentMode- The current document mode
-
isWindows
public boolean isWindows()
Tests if the browser is run on Windows.- Returns:
- true if run on Windows, false otherwise
-
isWindowsPhone
public boolean isWindowsPhone()
Tests if the browser is run on Windows Phone.- Returns:
- true if run on Windows Phone, false otherwise
- Since:
- 7.3.2
-
isMacOSX
public boolean isMacOSX()
Tests if the browser is run on Mac OSX.- Returns:
- true if run on Mac OSX, false otherwise
-
isLinux
public boolean isLinux()
Tests if the browser is run on Linux.- Returns:
- true if run on Linux, false otherwise
-
isAndroid
public boolean isAndroid()
Tests if the browser is run on Android.- Returns:
- true if run on Android, false otherwise
-
isIOS
public boolean isIOS()
Tests if the browser is run in iOS.- Returns:
- true if run in iOS, false otherwise
-
isIPhone
public boolean isIPhone()
Tests if the browser is run on iPhone.- Returns:
- true if run on iPhone, false otherwise
- Since:
- 7.3.3
-
isIPad
public boolean isIPad()
Tests if the browser is run on iPad.- Returns:
- true if run on iPad, false otherwise
- Since:
- 7.3.3
-
getOperatingSystemMajorVersion
public int getOperatingSystemMajorVersion()
Returns the major version of the operating system. Currently only supported for mobile devices (iOS/Android)- Returns:
- The major version or -1 if unknown
-
getOperatingSystemMinorVersion
public int getOperatingSystemMinorVersion()
Returns the minor version of the operating system. Currently only supported for mobile devices (iOS/Android)- Returns:
- The minor version or -1 if unknown
-
isTooOldToFunctionProperly
public boolean isTooOldToFunctionProperly()
Checks if the browser is so old that it simply won't work with a Vaadin application. NOTE that the browser might still be capable of running Crome Frame, so you might still want to checkisChromeFrameCapable()if this returns true.- Returns:
- true if the browser won't work, false if not the browser is supported or might work
-
-