Methods
profile([nav]) → {jQuery.client.Profile}static
#
Get an object containing information about the client.
Example
if ( $.client.profile().layout == 'gecko' ) {
// This will only run in Gecko browsers, such as Mozilla Firefox.
}
var profile = $.client.profile();
if ( profile.layout == 'gecko' && profile.platform == 'linux' ) {
// This will only run in Gecko browsers on Linux.
}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
nav |
Object |
optional |
window.navigator | An object with
a |
- Source:
Returns:
test(map, [profile], [exactMatchOnly]) → {boolean}static
#
Checks the current browser against a support map object.
Version numbers passed as numeric values will be compared like numbers (1.2 > 1.11). Version numbers passed as string values will be compared using a simple component-wise algorithm, similar to PHP's version_compare ('1.2' < '1.11').
A browser map is in the following format:
{
// Multiple rules with configurable operators
'msie': [['>=', 7], ['!=', 9]],
// Match no versions
'iphone': false,
// Match any version
'android': null
}
It can optionally be split into ltr/rtl sections:
{
'ltr': {
'android': null,
'iphone': false
},
'rtl': {
'android': false,
// rules are not inherited from ltr
'iphone': false
}
}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
map |
Object | Browser support map |
||
profile |
jQuery.client.Profile |
optional |
A client-profile object |
|
exactMatchOnly |
boolean |
optional |
false | Only return true if the browser is matched, otherwise returns true if the browser is not found. |
- Source:
Returns:
The current browser is in the support map
- Type
- boolean
Type Definitions
Profile
#
An object containing information about the client.
Example
{
'name': 'firefox',
'layout': 'gecko',
'layoutVersion': 20101026,
'platform': 'linux'
'version': '3.5.1',
'versionBase': '3',
'versionNumber': 3.5,
}
Type:
Properties:
Name | Type | Description |
---|---|---|
name |
string
|
'unknown'
|
Name of the browser. Recognized browser names:
|
layout |
string
|
'unknown'
|
Name of the layout engine. Recognised layout engines:
Note that Chrome and Chromium-based browsers like Opera have their layout
engine identified as |
layoutVersion |
number
|
'unknown'
|
Version of the layout engine,
e.g. |
platform |
string
|
'unknown'
|
Operating system the browser is running on. Recognised platforms:
|
version |
string
|
'unknown'
|
|
versionBase |
string
|
'unknown'
|
|
versionNumber |
number |
- Source: