## com.gargoylesoftware.htmlunit
Class BrowserVersion

    java.lang.Object
      com.gargoylesoftware.htmlunit.BrowserVersion

All Implemented Interfaces:
  java.io.Serializable

    public class BrowserVersion

extends java.lang.Object
implements java.io.Serializable

Objects of this class represent one specific version of a given browser. Predefined constants are provided for common browser versions. If you wish to create a BrowserVersion for a browser that doesn't have a constant defined but aren't sure what values to pass into the constructor then point your browser at http://htmlunit.sourceforge.net/cgi-bin/browserVersion and the code will be generated for you.

Version:
  $Revision: 4489 $
Author:
  Mike Bowler, Daniel Gredler, Marc Guillemot, Chris Erskine, Ahmed Ashour
See Also:
  Serialized Form

Field Summary
`static java.lang.String` `APP_CODE_NAME` Application code name for both Internet Explorer and Netscape series.
`static java.lang.String` `CPU_CLASS_X86` The X86 CPU class.
`static BrowserVersion` `FIREFOX_2` Firefox 2.
`static BrowserVersion` `FIREFOX_3` Firefox 3.
`static java.lang.String` `INTERNET_EXPLORER` Application name for the Internet Explorer series of browsers.
`static BrowserVersion` `INTERNET_EXPLORER_6` Internet Explorer 6.
`static BrowserVersion` `INTERNET_EXPLORER_7` Internet Explorer 7.
`static java.lang.String` `LANGUAGE_ENGLISH_US` United States English language identifier.
`static java.lang.String` `NETSCAPE` Application name the Netscape navigator series of browsers.
`static java.lang.String` `PLATFORM_WIN32` The WIN32 platform.

Constructor Summary
`BrowserVersion(java.lang.String applicationName, java.lang.String applicationVersion, java.lang.String userAgent, float browserVersionNumeric)` Instantiates one.
`BrowserVersion(java.lang.String applicationName, java.lang.String applicationVersion, java.lang.String userAgent, float browserVersionNumeric, BrowserVersionFeatures[] features)` Instantiates one.
`BrowserVersion(java.lang.String applicationName, java.lang.String applicationVersion, java.lang.String userAgent, java.lang.String javaScriptVersion, float browserVersionNumeric)` Deprecated. as of 2.5, use `BrowserVersion(String, String, String, float)`
`BrowserVersion(java.lang.String applicationName, java.lang.String applicationVersion, java.lang.String userAgent, java.lang.String javaScriptVersion, float browserVersionNumeric, BrowserVersionFeatures[] features)` Deprecated. as of 2.5, use `BrowserVersion(String, String, String, float, BrowserVersionFeatures[])`

Method Summary
`boolean` `equals(java.lang.Object o)`
`java.lang.String` `getApplicationCodeName()` Returns the application code name, for example "Mozilla".
`java.lang.String` `getApplicationMinorVersion()` Returns the application minor version, for example "0".
`java.lang.String` `getApplicationName()` Returns the application name, for example "Microsoft Internet Explorer".
`java.lang.String` `getApplicationVersion()` Returns the application version, for example "4.0 (compatible; MSIE 6.0b; Windows 98)".
`java.lang.String` `getBrowserLanguage()` Returns the browser application language, for example "en-us".
`float` `getBrowserVersionNumeric()`
`java.lang.String` `getCpuClass()` Returns the type of CPU in the machine, for example "x86".
`static BrowserVersion` `getDefault()` Returns the default browser version that is used whenever a specific version isn't specified.
`java.lang.String` `getJavaScriptVersion()` Deprecated. As of 2.5, with no replacement
`float` `getJavaScriptVersionNumeric()` Deprecated. As of 2.5, with no replacement
`java.lang.String` `getNickname()` Returns the short name of the browser like "FF3", "IE7", ...
`java.lang.String` `getPlatform()` Returns the platform on which the application is running, for example "Win32".
`java.util.Set<PluginConfiguration>` `getPlugins()` Returns the available plugins.
`java.lang.String` `getSystemLanguage()` Returns the system language, for example "en-us".
`java.lang.String` `getUserAgent()` Returns the user agent string, for example "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)".
`java.lang.String` `getUserLanguage()` Returns the user language, for example "en-us".
`boolean` `hasFeature(BrowserVersionFeatures property)` Indicates if this instance has the given feature.
`int` `hashCode()`
`boolean` `isFirefox()` Returns `true` if this `BrowserVersion` instance represents some version of Firefox like `FIREFOX_2` or `FIREFOX_3`.
`boolean` `isIE()` Returns `true` if this `BrowserVersion` instance represents some version of Internet Explorer.
`boolean` `isOnLine()` Returns `true` if the browser is currently online.
`void` `setApplicationCodeName(java.lang.String applicationCodeName)`
`void` `setApplicationMinorVersion(java.lang.String applicationMinorVersion)`
`void` `setApplicationName(java.lang.String applicationName)`
`void` `setApplicationVersion(java.lang.String applicationVersion)`
`void` `setBrowserLanguage(java.lang.String browserLanguage)`
`void` `setBrowserVersion(float browserVersion)`
`void` `setCpuClass(java.lang.String cpuClass)`
`static void` `setDefault(BrowserVersion newBrowserVersion)` Sets the default browser version that is used whenever a specific version isn't specified.
`void` `setJavaScriptVersion(java.lang.String javaScriptVersion)` Deprecated. As of 2.5, with no replacement
`void` `setOnLine(boolean onLine)`
`void` `setPlatform(java.lang.String platform)`
`void` `setSystemLanguage(java.lang.String systemLanguage)`
`void` `setUserAgent(java.lang.String userAgent)`
`void` `setUserLanguage(java.lang.String userLanguage)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### APP_CODE_NAME

    public static final java.lang.String APP_CODE_NAME

  Application code name for both Internet Explorer and Netscape series.

  See Also:
    Constant Field Values

### INTERNET_EXPLORER

    public static final java.lang.String INTERNET_EXPLORER

  Application name for the Internet Explorer series of browsers.

  See Also:
    Constant Field Values

### NETSCAPE

    public static final java.lang.String NETSCAPE

  Application name the Netscape navigator series of browsers.

  See Also:
    Constant Field Values

### LANGUAGE_ENGLISH_US

    public static final java.lang.String LANGUAGE_ENGLISH_US

  United States English language identifier.

  See Also:
    Constant Field Values

### CPU_CLASS_X86

    public static final java.lang.String CPU_CLASS_X86

  The X86 CPU class.

  See Also:
    Constant Field Values

### PLATFORM_WIN32

    public static final java.lang.String PLATFORM_WIN32

  The WIN32 platform.

  See Also:
    Constant Field Values

### FIREFOX_2

    public static final BrowserVersion FIREFOX_2

  Firefox 2.

### FIREFOX_3

    public static final BrowserVersion FIREFOX_3

  Firefox 3.

### INTERNET_EXPLORER_6

    public static final BrowserVersion INTERNET_EXPLORER_6

  Internet Explorer 6.

### INTERNET_EXPLORER_7

    public static final BrowserVersion INTERNET_EXPLORER_7

  Internet Explorer 7.

Constructor Detail

### BrowserVersion

    @Deprecated
    public BrowserVersion(java.lang.String applicationName,
                                     java.lang.String applicationVersion,
                                     java.lang.String userAgent,
                                     java.lang.String javaScriptVersion,
                                     float browserVersionNumeric)

  Deprecated. as of 2.5, use `BrowserVersion(String, String, String, float)`

  Instantiates one.

  Parameters:
    `applicationName` - the name of the application
    `applicationVersion` - the version string of the application
    `userAgent` - the user agent string that will be sent to the server
    `javaScriptVersion` - the version of JavaScript
    `browserVersionNumeric` - the floating number version of the browser

### BrowserVersion

    public BrowserVersion(java.lang.String applicationName,
                          java.lang.String applicationVersion,
                          java.lang.String userAgent,
                          float browserVersionNumeric)

  Instantiates one.

  Parameters:
    `applicationName` - the name of the application
    `applicationVersion` - the version string of the application
    `userAgent` - the user agent string that will be sent to the server
    `browserVersionNumeric` - the floating number version of the browser

### BrowserVersion

    @Deprecated
    public BrowserVersion(java.lang.String applicationName,
                                     java.lang.String applicationVersion,
                                     java.lang.String userAgent,
                                     java.lang.String javaScriptVersion,
                                     float browserVersionNumeric,
                                     BrowserVersionFeatures[] features)

  Deprecated. as of 2.5, use `BrowserVersion(String, String, String, float, BrowserVersionFeatures[])`

  Instantiates one.

  Parameters:
    `applicationName` - the name of the application
    `applicationVersion` - the version string of the application
    `userAgent` - the user agent string that will be sent to the server
    `javaScriptVersion` - the version of JavaScript
    `browserVersionNumeric` - the floating number version of the browser
    `features` - the browser features

### BrowserVersion

    public BrowserVersion(java.lang.String applicationName,
                          java.lang.String applicationVersion,
                          java.lang.String userAgent,
                          float browserVersionNumeric,
                          BrowserVersionFeatures[] features)

  Instantiates one.

  Parameters:
    `applicationName` - the name of the application
    `applicationVersion` - the version string of the application
    `userAgent` - the user agent string that will be sent to the server
    `browserVersionNumeric` - the floating number version of the browser
    `features` - the browser features

Method Detail

### getDefault

    public static BrowserVersion getDefault()

  Returns the default browser version that is used whenever a specific version isn't specified. Defaults to `INTERNET_EXPLORER_7`.

  Returns:
    the default browser version

### setDefault

    public static void setDefault(BrowserVersion newBrowserVersion)

  Sets the default browser version that is used whenever a specific version isn't specified.

  Parameters:
    `newBrowserVersion` - the new default browser version

### isIE

    public final boolean isIE()

  Returns `true` if this `BrowserVersion` instance represents some version of Internet Explorer.

  Returns:
    whether or not this version is a version of IE

### isFirefox

    public final boolean isFirefox()

  Returns `true` if this `BrowserVersion` instance represents some version of Firefox like `FIREFOX_2` or `FIREFOX_3`.

  Returns:
    whether or not this version is a version of a Firefox browser

### getApplicationCodeName

    public java.lang.String getApplicationCodeName()

  Returns the application code name, for example "Mozilla". Default value is `APP_CODE_NAME` if not explicitly configured.

  Returns:
    the application code name
  See Also:
    MSDN documentation

### getApplicationMinorVersion

    public java.lang.String getApplicationMinorVersion()

  Returns the application minor version, for example "0". Default value is "0" if not explicitly configured.

  Returns:
    the application minor version
  See Also:
    MSDN documentation

### getApplicationName

    public java.lang.String getApplicationName()

  Returns the application name, for example "Microsoft Internet Explorer".

  Returns:
    the application name
  See Also:
    MSDN documentation

### getApplicationVersion

    public java.lang.String getApplicationVersion()

  Returns the application version, for example "4.0 (compatible; MSIE 6.0b; Windows 98)".

  Returns:
    the application version
  See Also:
    MSDN documentation

### getBrowserLanguage

    public java.lang.String getBrowserLanguage()

  Returns the browser application language, for example "en-us". Default value is `LANGUAGE_ENGLISH_US` if not explicitly configured.

  Returns:
    the browser application language
  See Also:
    MSDN documentation

### getCpuClass

    public java.lang.String getCpuClass()

  Returns the type of CPU in the machine, for example "x86". Default value is `CPU_CLASS_X86` if not explicitly configured.

  Returns:
    the type of CPU in the machine
  See Also:
    MSDN documentation

### isOnLine

    public boolean isOnLine()

  Returns `true` if the browser is currently online. Default value is `true` if not explicitly configured.

  Returns:
    `true` if the browser is currently online
  See Also:
    MSDN documentation

### getPlatform

    public java.lang.String getPlatform()

  Returns the platform on which the application is running, for example "Win32". Default value is `PLATFORM_WIN32` if not explicitly configured.

  Returns:
    the platform on which the application is running
  See Also:
    MSDN documentation

### getSystemLanguage

    public java.lang.String getSystemLanguage()

  Returns the system language, for example "en-us". Default value is `LANGUAGE_ENGLISH_US` if not explicitly configured.

  Returns:
    the system language
  See Also:
    MSDN documentation

### getUserAgent

    public java.lang.String getUserAgent()

  Returns the user agent string, for example "Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)".

  Returns:
    the user agent string

### getUserLanguage

    public java.lang.String getUserLanguage()

  Returns the user language, for example "en-us". Default value is `LANGUAGE_ENGLISH_US` if not explicitly configured.

  Returns:
    the user language
  See Also:
    MSDN documentation

### getJavaScriptVersion

    @Deprecated
    public java.lang.String getJavaScriptVersion()

  Deprecated. As of 2.5, with no replacement

  Returns the version of JavaScript used by the browser, for example "1.2".

  Returns:
    the version of JavaScript used by the browser

### setApplicationCodeName

    public void setApplicationCodeName(java.lang.String applicationCodeName)

  Parameters:
    `applicationCodeName` - the applicationCodeName to set

### setApplicationMinorVersion

    public void setApplicationMinorVersion(java.lang.String applicationMinorVersion)

  Parameters:
    `applicationMinorVersion` - the applicationMinorVersion to set

### setApplicationName

    public void setApplicationName(java.lang.String applicationName)

  Parameters:
    `applicationName` - the applicationName to set

### setApplicationVersion

    public void setApplicationVersion(java.lang.String applicationVersion)

  Parameters:
    `applicationVersion` - the applicationVersion to set

### setBrowserLanguage

    public void setBrowserLanguage(java.lang.String browserLanguage)

  Parameters:
    `browserLanguage` - the browserLanguage to set

### setCpuClass

    public void setCpuClass(java.lang.String cpuClass)

  Parameters:
    `cpuClass` - the cpuClass to set

### setJavaScriptVersion

    @Deprecated
    public void setJavaScriptVersion(java.lang.String javaScriptVersion)

  Deprecated. As of 2.5, with no replacement

  Parameters:
    `javaScriptVersion` - the javaScriptVersion to set

### setOnLine

    public void setOnLine(boolean onLine)

  Parameters:
    `onLine` - the onLine to set

### setPlatform

    public void setPlatform(java.lang.String platform)

  Parameters:
    `platform` - the platform to set

### setSystemLanguage

    public void setSystemLanguage(java.lang.String systemLanguage)

  Parameters:
    `systemLanguage` - the systemLanguage to set

### setUserAgent

    public void setUserAgent(java.lang.String userAgent)

  Parameters:
    `userAgent` - the userAgent to set

### setUserLanguage

    public void setUserLanguage(java.lang.String userLanguage)

  Parameters:
    `userLanguage` - the userLanguage to set

### setBrowserVersion

    public void setBrowserVersion(float browserVersion)

  Parameters:
    `browserVersion` - the browserVersion to set

### getBrowserVersionNumeric

    public float getBrowserVersionNumeric()

  Returns:
    the browserVersionNumeric

### getJavaScriptVersionNumeric

    @Deprecated
    public float getJavaScriptVersionNumeric()

  Deprecated. As of 2.5, with no replacement

  Returns:
    the javaScriptVersionNumeric

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### getPlugins

    public java.util.Set<PluginConfiguration> getPlugins()

  Returns the available plugins. This makes only sense for Firefox as only this browser makes this kind of information available via JavaScript.

  Returns:
    the available plugins

### hasFeature

    public boolean hasFeature(BrowserVersionFeatures property)

  Indicates if this instance has the given feature. Used for HtmlUnit internal processing.

  Parameters:
    `property` - the property name
  Returns:
    `false` if this browser doesn't have this feature

### getNickname

    public java.lang.String getNickname()

  Returns the short name of the browser like "FF3", "IE7", ... This is used in different tests to reference the browser to which it applies.

  Returns:
    the short name (if any)

Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.