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

Joomla CMS

Methods

__construct

Create a browser instance (constructor).

__construct( userAgent = null,  accept = null) : 
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() : 

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

Response

void

getAgentString

Return the full browser agent string.

getAgentString() : 
since

1.7.0

Response

stringThe browser agent string

getBrowser

Retrieve the current browser.

getBrowser() : 
since

1.7.0

Response

stringThe current browser.

getHTTPProtocol

Returns the server protocol in use on the current server.

getHTTPProtocol() : 
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( userAgent = null,  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

BrowserThe Browser object.

getMajor

Retrieve the current browser's major version.

getMajor() : 
since

1.7.0

Response

intThe current browser's major version

getMinor

Retrieve the current browser's minor version.

getMinor() : 
since

1.7.0

Response

intThe current browser's minor version.

getPlatform

Return the currently matched platform.

getPlatform() : 
since

1.7.0

Response

stringThe user's platform.

getVersion

Retrieve the current browser's version.

getVersion() : 
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() : 
since

1.7.0

Response

void

isBrowser

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

isBrowser( browser) : 
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() : 
since

1.7.0

Response

boolTrue if browser is a known mobile version.

isRobot

Determines if the browser is a robot or not.

isRobot() : 
since

1.7.0

Response

boolTrue if browser is a known robot.

isViewable

Determines if a browser can display a given MIME type.

isViewable( mimetype) : 

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( userAgent = null,  accept = null) : 
since

1.7.0

Arguments

userAgent

stringThe browser string to parse.

accept

stringThe HTTP_ACCEPT settings to use.

Response

void

setBrowser

Sets the current browser.

setBrowser( browser) : 
since

1.7.0

Arguments

browser

stringThe browser to set as current.

Response

void

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<string|int, mixed>

platform

Platform the browser is running on

since

3.0.0

Type(s)

string

robots

Known robots.

since

3.0.0

Type(s)

array<string|int, mixed>

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<string|int, mixed>

instances

Browser instances container.

static
since

1.7.3

Type(s)

array<string|int, mixed>