ƒ.browser - Get-Kraken/fixx GitHub Wiki
Browser properties and feature detects
ƒ.browser.is
IE variants: returns a boolean true/false
(lt = less than | lte = less than or equal to)
(gt = greater than | gte = greater than or equal to)
ƒ.browser.is.IE();
- True if browser is IE and v11 or less
ƒ.browser.is.IE8();
- IE8 only
ƒ.browser.is.gtIE8();
- IE9+
ƒ.browser.is.IE9();
- IE9 only
ƒ.browser.is.IE10();
- IE10 only
ƒ.browser.is.gteIE10();
- IE10+
ƒ.browser.is.ltIE11();
- IE10- (< IE11)
ƒ.browser.is.IE11();
- IE11 only
ƒ.browser.is.Edge();
- IE Edge only
Example use with css:
css:
.ie9 {/* ie9 styles here */}
js:
$('body').addClass(ƒ.browser.is.IE9() ? 'ie9' : '');
Mobile / Desktop detect
mobile:
ƒ.browser.is.mobile() // → true/false
desktop:
ƒ.browser.is.desktop() // → true/false
The desktop detect checks the window width to be > 1024.
Will return false
on a desktop if the window width is < 1024.
ƒ.browser.os
Operating System detect (OS)
To detect the current browser's operating system call:
ƒ.browser.os();
Returns 'unknown OS'
if detect can't find the OS.
Current detects:
iPhone
iPad
SymbianOS
Android
BlackBerry
BlackBerry Tablet
Kindle
(fire)MeeGo OS
(nokia)Windows Phone
Windows
Mac
Linux
ƒ.browser.name
Browser name detect
To detect the current browser name, call:
ƒ.browser.name();
Returns 'unknown browser'
if detect can't find the .
Current detects:
Opera
(pre and post move to WebKit)Chrome
OmniWeb
Safari
iCab
Konqueror
Firefox
Camino
WebKit
(iPhone, iPad, RIM, BB, Silk, NokiaBrowser, Samsung Mobile, Samsung Tablet)Explorer
Edge
Netscape
(for newer Netscapes {6+})Mozilla
(for older Netscapes {4-})
ƒ.browser.version
Browser version detect
To detect the current browser version, call:
ƒ.browser.version();
Desktop browsers return the browser version of the browser name (like IE, FF and CR);
Where detected as 'WebKit'
(mobiles), it returns the WebKit version.