Browser

Browser class, provides capability information about the current web client.

Browser identification is performed by examining the HTTP_USER_AGENT environment variable provided by the web server.

This class has many influences from the lib/Browser.php code in version 3 of Horde by Chuck Hagenbuch and Jon Parise.

since

1.7.0

package

Application

Methods

__construct

Create a browser instance (constructor).

__construct(string userAgent = null, string accept = null) : mixed
since

1.7.0

Arguments

userAgent

stringThe browser string to parse.

accept

stringThe HTTP_ACCEPT settings to use.

Response

mixed

_setPlatform

Match the platform of the browser.

_setPlatform() : void

This is a pretty simplistic implementation, but it's intended to let us tell what line breaks to send, so it's good enough for its purpose.

since

1.7.0

getAgentString

Return the full browser agent string.

getAgentString() : string
since

1.7.0

Response

stringThe browser agent string

getBrowser

Retrieve the current browser.

getBrowser() : string
since

1.7.0

Response

stringThe current browser.

getHTTPProtocol

Returns the server protocol in use on the current server.

getHTTPProtocol() : string
since

1.7.0

Response

stringThe HTTP server protocol version.

getInstance

Returns the global Browser object, only creating it if it doesn't already exist.

getInstance(string userAgent = null, string accept = null) : \Joomla\CMS\Environment\Browser
static
since

1.7.0

Arguments

userAgent

stringThe browser string to parse.

accept

stringThe HTTP_ACCEPT settings to use.

Response

\Joomla\CMS\Environment\BrowserThe Browser object.

getMajor

Retrieve the current browser's major version.

getMajor() : int
since

1.7.0

Response

intThe current browser's major version

getMinor

Retrieve the current browser's minor version.

getMinor() : int
since

1.7.0

Response

intThe current browser's minor version.

getPlatform

Return the currently matched platform.

getPlatform() : string
since

1.7.0

Response

stringThe user's platform.

getVersion

Retrieve the current browser's version.

getVersion() : string
since

1.7.0

Response

stringThe current browser's version.

identifyBrowserVersion

Set browser version, not by engine version Fallback to use when no other method identify the engine version

identifyBrowserVersion() : void
since

1.7.0

isBrowser

Determine if the given browser is the same as the current.

isBrowser(string browser) : bool
since

1.7.0

Arguments

browser

stringThe browser to check.

Response

boolIs the given browser the same as the current?

isMobile

Determines if the browser is mobile version or not.

isMobile() : bool
since

1.7.0

Response

boolTrue if browser is a known mobile version.

isRobot

Determines if the browser is a robot or not.

isRobot() : bool
since

1.7.0

Response

boolTrue if browser is a known robot.

isViewable

Determines if a browser can display a given MIME type.

isViewable(string mimetype) : bool

Note that image/jpeg and image/pjpeg appear to be the same entity, but Mozilla doesn't seem to want to accept the latter. For our purposes, we will treat them the same.

since

1.7.0

Arguments

mimetype

stringThe MIME type to check.

Response

boolTrue if the browser can display the MIME type.

match

Parses the user agent string and inititializes the object with all the known features and quirks for the given browser.

match(string userAgent = null, string accept = null) : void
since

1.7.0

Arguments

userAgent

stringThe browser string to parse.

accept

stringThe HTTP_ACCEPT settings to use.

setBrowser

Sets the current browser.

setBrowser(string browser) : void
since

1.7.0

Arguments

browser

stringThe browser to set as current.

Properties

majorVersion

Major version number

since

3.0.0

Type(s)

int

minorVersion

Minor version number

since

3.0.0

Type(s)

int

browser

Browser name.

since

3.0.0

Type(s)

string

agent

Full user agent string.

since

3.0.0

Type(s)

string

lowerAgent

Lower-case user agent string

since

3.0.0

Type(s)

string

accept

HTTP_ACCEPT string.

since

3.0.0

Type(s)

string

acceptParsed

Parsed HTTP_ACCEPT string

since

3.0.0

Type(s)

array

platform

Platform the browser is running on

since

3.0.0

Type(s)

string

robots

Known robots.

since

3.0.0

Type(s)

array

mobile

Is this a mobile browser?

since

3.0.0

Type(s)

bool

images

List of viewable image MIME subtypes.

This list of viewable images works for IE and Netscape/Mozilla.

since

3.0.0

Type(s)

array

instances

Browser instances container.

static
since

1.7.3

Type(s)

array