public class WebBrowser extends Object implements Serializable
Constructor and Description |
---|
WebBrowser() |
Modifier and Type | Method and Description |
---|---|
String |
getAddress()
Gets the IP-address of the web browser.
|
String |
getBrowserApplication()
Get the browser user-agent string.
|
int |
getBrowserMajorVersion()
Gets the major version of the browser the user is using.
|
int |
getBrowserMinorVersion()
Gets the minor version of the browser the user is using.
|
Date |
getCurrentDate()
Returns the current date and time of the browser.
|
int |
getDSTSavings()
Returns the offset in milliseconds between the browser's GMT TimeZone and
DST.
|
Locale |
getLocale()
Get the default locate of the browser.
|
int |
getRawTimezoneOffset()
Returns the browser-reported TimeZone offset in milliseconds from GMT
ignoring possible daylight saving adjustments that may be in effect in
the browser.
|
int |
getScreenHeight()
Gets the height of the screen in pixels.
|
int |
getScreenWidth()
Gets the width of the screen in pixels.
|
int |
getTimezoneOffset()
Returns the browser-reported TimeZone offset in milliseconds from GMT.
|
boolean |
isAndroid()
Tests if the browser is run on Android.
|
boolean |
isChrome()
Tests whether the user is using Chrome.
|
boolean |
isChromeFrame()
Tests whether the user is using Chrome Frame.
|
boolean |
isChromeFrameCapable()
Tests whether the user's browser is Chrome Frame capable.
|
boolean |
isDSTInEffect()
Returns whether daylight saving time (DST) is currently in effect in the
region of the browser or not.
|
boolean |
isEdge()
Tests whether the user is using Edge.
|
boolean |
isFirefox()
Tests whether the user is using Firefox.
|
boolean |
isIE()
Tests whether the user is using Internet Explorer.
|
boolean |
isIOS()
Tests if the browser is run in iOS.
|
boolean |
isIPad()
Tests if the browser is run on IPad.
|
boolean |
isIPhone()
Tests if the browser is run on IPhone.
|
boolean |
isLinux()
Tests whether the user is using Linux.
|
boolean |
isMacOSX()
Tests whether the user is using Mac OS X.
|
boolean |
isOpera()
Tests whether the user is using Opera.
|
boolean |
isSafari()
Tests whether the user is using Safari.
|
boolean |
isSecureConnection()
Is the connection made using HTTPS?
|
boolean |
isTooOldToFunctionProperly()
Checks if the browser is so old that it simply won't work with a Vaadin
application.
|
boolean |
isTouchDevice() |
boolean |
isWindows()
Tests whether the user is using Windows.
|
boolean |
isWindowsPhone()
Tests whether the user is using Windows Phone.
|
void |
updateRequestDetails(VaadinRequest request)
For internal use by VaadinServlet/VaadinPortlet only.
|
public int getScreenHeight()
public int getScreenWidth()
public String getBrowserApplication()
public String getAddress()
public Locale getLocale()
public boolean isSecureConnection()
public boolean isFirefox()
public boolean isIE()
public boolean isEdge()
public boolean isSafari()
public boolean isOpera()
public boolean isChrome()
public boolean isChromeFrame()
public boolean isChromeFrameCapable()
public int getBrowserMajorVersion()
Note that Internet Explorer in IE7 compatibility mode might return 8 in some cases even though it should return 7.
public int getBrowserMinorVersion()
getBrowserMajorVersion()
public boolean isLinux()
public boolean isMacOSX()
public boolean isWindows()
public boolean isWindowsPhone()
public boolean isAndroid()
public boolean isIOS()
public boolean isIPhone()
public boolean isIPad()
public int getTimezoneOffset()
getRawTimezoneOffset()
.getRawTimezoneOffset()
public int getRawTimezoneOffset()
You can use this to figure out which TimeZones the user could actually be
in by calling TimeZone.getAvailableIDs(int)
.
If getRawTimezoneOffset()
and getTimezoneOffset()
returns the same value, the browser is either in a zone that does not
currently have daylight saving time, or in a zone that never has daylight
saving time.
public int getDSTSavings()
public boolean isDSTInEffect()
public Date getCurrentDate()
To get the actual date and time shown in the end users computer, you can do something like:
WebBrowser browser = ...; SimpleTimeZone timeZone = new SimpleTimeZone(browser.getTimezoneOffset(), "Fake client time zone"); DateFormat format = DateFormat.getDateTimeInstance(); format.setTimeZone(timeZone); myLabel.setValue(format.format(browser.getCurrentDate()));
isDSTInEffect()
,
getDSTSavings()
,
getTimezoneOffset()
public boolean isTouchDevice()
public void updateRequestDetails(VaadinRequest request)
request
- the Vaadin request to read the information frompublic boolean isTooOldToFunctionProperly()
Copyright © 2017 Vaadin Ltd. All rights reserved.