System

Browser version and browser support information.

Preferably the detection is based purely on features specific to certain browsers and versions, to avoid unintended results with user-spoofed useragents. However, collecting this information is very time consuming and the ability to detect in spite of userAgent spoofing may vary.

Functions

Util.browser

Definition

Name
Util.browser
Shorthand
u.browser
Syntax
Mixed = Util.browser( String model [,Mixed version] )

Description

Detect if browser matches a specific model and optional version scope.

Parameters

model
String Name of browser to check for
Options
edge
Microsoft Edge
ie
Internet Explorer
explorer
Internet Explorer
firefox
Firefox
gecko
Firefox
webkit
webkit based
chrome
Chrome
safari
Safari (or webkit based, not Chrome)
opera
Opera
version
Mixed Optional. Version number or scope as 6, <6, >12 etc.

Returns

If scope is stated, function returns boolean (true for match, false for mismatch), if only model is stated function returns version on match, false on mismatch.

Examples

u.browser("ie", ">8");

returns true if browser is IE and version greater than 8, else false

u.browser("firefox");

returns version of Firefox if browser is Firefox, else false

u.browser("ie,edge");

returns true if browser is either IE or chrome

Uses

JavaScript
  • navigator
  • String.match
  • eval
  • isNaN
Manipulator
  • none

Util.support

Definition

Name
Util.support
Syntax
Boolean = Util.support( String property );

Description

Check if browser has support for CSS property. Automatically looks for vendor prefixed method to provide support.

Parameters

property
String CSS property to check support for

Returns

Boolean Whether the browser supports the CSS-property.

Examples

u.support("opacity");

returns true if browser supports opacity, else false

Uses

JavaScript
  • document.documentElement
  • String.replace
  • String.toUpperCase
Manipulator

None

Util.system

Definition

Name
Util.system
Syntax
Mixed = Util.system( String os );

Description

Detect if the current OS matches os

Parameters

os
String Name of OS to check for
Options
mac
Mac
windows
Windows
linux
Linux based
ios
iOS
android
Android
winphone
Windows Phone

Returns

Mixed - version number or boolean is current OS matches os.

Examples

u.system("mac");

returns true if OS is a Mac, else false

u.system("android,winphone");

returns true if OS is a Android or Windows Phone, else false

Uses

JavaScript
  • navigator
  • String.match
  • eval
  • isNaN
Manipulator
  • none

Files

Main file

  • u-system.js

Segment support files

  • none

Segment dependencies

desktop_edge
u-system.js
desktop_ie11
u-system.js
desktop
u-system.js
desktop_ie10
u-system.js
desktop_ie9
u-system.js
desktop_light
u-system.js
tablet
u-system.js
tablet_light
u-system.js
smartphone
u-system.js
mobile
not tested
mobile_light
not tested
tv
u-system.js
seo
not supported