Package muntjac :: Package terminal :: Package gwt :: Package server :: Module web_browser :: Class WebBrowser
[hide private]
[frames] | no frames]

Class WebBrowser

source code

        object --+    
                 |    
terminal.ITerminal --+
                     |
                    WebBrowser

Class that provides information about the web browser the user is using. Provides information such as browser name and version, screen resolution and IP address.


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getDefaultTheme(self)
There is no default-theme for this terminal type.
source code
 
getScreenHeight(self)
Gets the height of the terminal screen in pixels.
source code
 
getScreenWidth(self)
Gets the width of the terminal screen in pixels.
source code
 
getBrowserApplication(self)
Get the browser user-agent string.
source code
 
getAddress(self)
Gets the IP-address of the web browser.
source code
 
getLocale(self)
Get the default locate of the browser.
source code
 
isSecureConnection(self)
Is the connection made using HTTPS?
source code
 
isFirefox(self)
Tests whether the user is using Firefox.
source code
 
isIE(self)
Tests whether the user is using Internet Explorer.
source code
 
isSafari(self)
Tests whether the user is using Safari.
source code
 
isOpera(self)
Tests whether the user is using Opera.
source code
 
isChrome(self)
Tests whether the user is using Chrome.
source code
 
getBrowserMajorVersion(self)
Gets the major version of the browser the user is using.
source code
 
getBrowserMinorVersion(self)
Gets the minor version of the browser the user is using.
source code
 
isLinux(self)
Tests whether the user is using Linux.
source code
 
isMacOSX(self)
Tests whether the user is using Mac OS X.
source code
 
isWindows(self)
Tests whether the user is using Windows.
source code
 
getTimezoneOffset(self)
Returns the browser-reported TimeZone offset in milliseconds from GMT.
source code
 
getRawTimezoneOffset(self)
Returns the browser-reported TimeZone offset in milliseconds from GMT ignoring possible daylight saving adjustments that may be in effect in the browser.
source code
 
getDSTSavings(self)
Gets the difference in minutes between the browser's GMT TimeZone and DST.
source code
 
isDSTInEffect(self)
Determines whether daylight savings time (DST) is currently in effect in the region of the browser or not.
source code
 
getCurrentDate(self)
Returns the current date and time of the browser.
source code
 
isTouchDevice(self)
Returns: true if the browser is detected to support touch events
source code
 
updateClientSideDetails(self, sw, sh, tzo, rtzo, dstSavings, dstInEffect, curDate, touchDevice)
For internal use by AbstractApplicationServlet only.
source code
 
updateRequestDetails(self, locale, address, secureConnection, agent)
For internal use by AbstractApplicationServlet only.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

getDefaultTheme(self)

source code 

There is no default-theme for this terminal type.

Returns:
Always returns null.
Overrides: terminal.ITerminal.getDefaultTheme

getScreenHeight(self)

source code 

Gets the height of the terminal screen in pixels. This is the height of the screen and not the height available for the application.

Note that the screen height is typically not available in the Application.init method as this is called before the browser has a chance to report the screen size to the server.

Returns:
the height of the terminal screen.
Overrides: terminal.ITerminal.getScreenHeight
(inherited documentation)

getScreenWidth(self)

source code 

Gets the width of the terminal screen in pixels. This is the width of the screen and not the width available for the application.

Note that the screen width is typically not available in the Application.init method as this is called before the browser has a chance to report the screen size to the server.

Returns:
the width of the terminal screen.
Overrides: terminal.ITerminal.getScreenWidth
(inherited documentation)

getBrowserApplication(self)

source code 

Get the browser user-agent string.

Returns:
The raw browser userAgent string

getAddress(self)

source code 

Gets the IP-address of the web browser. If the application is running inside a portlet, this method will return None.

Returns:
IP-address in 1.12.123.123 -format

isFirefox(self)

source code 

Tests whether the user is using Firefox.

Returns:
true if the user is using Firefox, false if the user is not using Firefox or if no information on the browser is present

isIE(self)

source code 

Tests whether the user is using Internet Explorer.

Returns:
true if the user is using Internet Explorer, false if the user is not using Internet Explorer or if no information on the browser is present

isSafari(self)

source code 

Tests whether the user is using Safari.

Returns:
true if the user is using Safari, false if the user is not using Safari or if no information on the browser is present

isOpera(self)

source code 

Tests whether the user is using Opera.

Returns:
true if the user is using Opera, false if the user is not using Opera or if no information on the browser is present

isChrome(self)

source code 

Tests whether the user is using Chrome.

Returns:
true if the user is using Chrome, false if the user is not using Chrome or if no information on the browser is present

getBrowserMajorVersion(self)

source code 

Gets the major version of the browser the user is using.

Note that Internet Explorer in IE7 compatibility mode might return 8 in some cases even though it should return 7.

Returns:
The major version of the browser or -1 if not known.

getBrowserMinorVersion(self)

source code 

Gets the minor version of the browser the user is using.

Returns:
The minor version of the browser or -1 if not known.

See Also: #getBrowserMajorVersion()

isLinux(self)

source code 

Tests whether the user is using Linux.

Returns:
true if the user is using Linux, false if the user is not using Linux or if no information on the browser is present

isMacOSX(self)

source code 

Tests whether the user is using Mac OS X.

Returns:
true if the user is using Mac OS X, false if the user is not using Mac OS X or if no information on the browser is present

isWindows(self)

source code 

Tests whether the user is using Windows.

Returns:
true if the user is using Windows, false if the user is not using Windows or if no information on the browser is present

getTimezoneOffset(self)

source code 

Returns the browser-reported TimeZone offset in milliseconds from GMT. This includes possible daylight saving adjustments, to figure out which TimeZone the user actually might be in, see getRawTimezoneOffset.

Returns:
timezone offset in milliseconds, 0 if not available

getRawTimezoneOffset(self)

source code 

Returns the browser-reported TimeZone offset in milliseconds from GMT ignoring possible daylight saving adjustments that may be in effect in the browser.

You can use this to figure out which TimeZones the user could actually be in by calling TimeZone.getAvailableIDs.

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.

Returns:
timezone offset in milliseconds excluding DST, 0 if not available

getDSTSavings(self)

source code 

Gets the difference in minutes between the browser's GMT TimeZone and DST.

Returns:
the amount of minutes that the TimeZone shifts when DST is in effect

isDSTInEffect(self)

source code 

Determines whether daylight savings time (DST) is currently in effect in the region of the browser or not.

Returns:
true if the browser resides at a location that currently is in DST

getCurrentDate(self)

source code 

Returns the current date and time of the browser. This will not be entirely accurate due to varying network latencies, but should provide a close-enough value for most cases. Also note that the returned Date object uses servers default time zone, not the clients.

Returns:
the current date and time of the browser.

isTouchDevice(self)

source code 
Returns:
true if the browser is detected to support touch events

updateClientSideDetails(self, sw, sh, tzo, rtzo, dstSavings, dstInEffect, curDate, touchDevice)

source code 

For internal use by AbstractApplicationServlet only. Updates all properties in the class according to the given information.

Parameters:
  • sw - Screen width
  • sh - Screen height
  • tzo - TimeZone offset in minutes from GMT
  • rtzo - raw TimeZone offset in minutes from GMT (w/o DST adjustment)
  • dstSavings - the difference between the raw TimeZone and DST in minutes
  • dstInEffect - is DST currently active in the region or not?
  • curDate - the current date in milliseconds since the epoch
  • touchDevice

updateRequestDetails(self, locale, address, secureConnection, agent)

source code 

For internal use by AbstractApplicationServlet only. Updates all properties in the class according to the given information.

Parameters:
  • locale - The browser primary locale
  • address - The browser ip address
  • secureConnection - true if using an https connection
  • agent - Raw userAgent string from the browser