Class BROWSER

Description

Encapsulates all information about the client.

The class reads the values from the current session, by default, but can be loaded using load_from_string(). Use supports() and is() to determine the capabilities of the underlying renderer.

The user agent detection mechanism makes a distinction between the name of the browser and the technology used to render content. The browser name (e. g. MSN) is available through name() and version(), while the underlying renderer (e.g. IE 6.0) is available through (renderer_name() and renderer_version()). Use system_id() to get a formatted operating system name or system_name() and system_version() to access the information directly.

Located in /lib/main/webcore/util/browser.php (line 203)

Variable Summary

Method Summary

Variables

Variable $user_agent_string (line 210)

User-agent string received in HTTP request.

Set this property with load_from_server() or load_from_string().

public string $user_agent_string

Methods

Constructor __construct (line 215)

Calls load_from_server() by default.

public BROWSER __construct ()

Method calculated_system_name (line 412)

Calculated system name.

The most likely operating system derived from the user agent string.

public string calculated_system_name ()

Method description_as_html (line 279)

Return a description as HTML.

public string description_as_html ()

Method description_as_plain_text (line 288)

Return a description as plain text.

public string description_as_plain_text ()

Method domain (line 248)

Resolve the domain name of the browser.

Performs a reverse name lookup of the ip_address().

public string domain ()

Method gecko_date (line 453)

Build date of the client, if built with Gecko.

Gecko is the mozilla browser technology. Conforming user agent strings include the build date of the Gecko component. (Can be empty)

public DATE_TIME gecko_date ()

Method icon_name (line 344)

Name of the icon to use.

Use this location with CONTEXT::icon_as_html() to render the icon in a WebCore application.

public string icon_name ()

Method ip_address (line 259)

The actual ip address of the browser.

Will resolve the proxy forward, if one is present in the HTTP header.

public string ip_address ()

Method is (line 465)

Does the client match the given code? The code can be an operating system (like Browser_os_mac) or a browser identifier (like Browser_os_opera).

public boolean is (string $code)

  • string $code

Method load_from_server (line 225)

Read the user agent from the server environment.

Called automatically from the constructor.

public void load_from_server ()

Method load_from_string (line 235)

Read from a given user agent.

Used primarily for testing.

public void load_from_string (mixed $s)

  • mixed $s

Method name (line 321)

Name of the browser.

Not necessarily the same as the renderer name. AOL uses the IE engine or the Gecko engine, depending on version. MSN uses the IE engine.

public string name ()

Method renderer_name (line 299)

Identifies the technology used by this browser.

This is often different than the name, since many browsers employ embedded renderers like Gecko, or are rebranded like Opera Composer browsers.

public string renderer_name ()

Method renderer_version (line 310)

Identifies the version of the technology used by this browser.

This is the number used internall to identify whether a feature is supported.

public string renderer_version ()

Method supports (line 477)

Is the requested functionality supported? See the browser functionality constants.

public boolean supports (integer $code)

  • integer $code

Method system_id (line 428)

Fully formatted operating system id.

Returns as much information about the operating system as possible, favoring the interpreted system name because it's generally capitalized better.

  • 'Windows 5.1' will return 'Windows 5.1 (Windows 2000)'
  • 'Linux i686 ... Debian/1.2.0' will return 'Debian 1.2.0 (Linux)'

public string system_id ()

Method system_name (line 392)

Specific name of the operating system.

public string system_name ()

Method system_version (line 402)

Operating system version.

This is specific, like Windows NT 5.1 (Windows 2000) will return 5.1, not 2000.

public string system_version ()

Method version (line 333)

Version of the browser.

Not necessarily the same as the renderer version. Largely useless identifier for determining feature support, but nice to use when showing a user which browser they are running. e.g. displaying 'MSN 7.0' instead of 'IE 5.5sp1'.

public string version ()

Protected Method _description_as_text (line 543)

Build a human-readable description.

protected string _description_as_text ([boolean $text_only = false])

  • boolean $text_only: May include HTML tags if not set.

Protected Method _make_user_agent_parser (line 588)

protected USER_AGENT_PARSER _make_user_agent_parser (mixed $tables)

  • mixed $tables

Protected Method _make_user_agent_parse_tables (line 579)

protected USER_AGENT_PARSE_TABLES _make_user_agent_parse_tables ()