CSS/JS Browser Determiner

CSS/JS Browser Determiner

It’s lightweight (2kb gzipped or 3,8kb minified) JavaScript browser detector that can be used in all your web projects. It’s created to help you to write CSS or JavaScript code for any specific browser, version of browser or whatnot in a very easy way. Detect layout engine, OS, support for CSS features and more.

It is indispensable solution for building cross-browser and cross-platform web-sites and web-applications.

How it works? Very simple. It generates a list of classes with detailed information about browser, layout engine, OS, device and then attaches it to <html> tag.

Unlike well-known Modernizr, the CSS/JS Browser Determiner is mostly focused not on the browser features but on the browser and the device itself. But it also determines the support of common CSS features.

Browser Detection With JavaScript

if (browser.ie && browser.version <= 8 ) {
// Code for MSIE 8 or less
}
if (browser.is_mobile) {
// Code for mobile devices
}
if (browser.is_old) {
// Code for old browsers such as:
// MSIE 9 or less
// Firefox 3.6 or less
// Safari 3.0 or less
// Opera 10.1 or less
}
if (browser.supports("border-radius")) {
// Code for browsers that supports the CSS3 border-radius property
}
if (browser.is_desktop) {
// Window width is 980px or more
}

Responsive Utilities

CSS/JS Browser Determiner is also supports basic responsive utilites for faster mobile-friendly development. You can use CSS selectors to determine the desktop, tablet or phone platform. It can be helpful if you need responsive support in Internet Explorer 8 (or less), which does not supports CSS3 Media Queries.

Version 2.0.1 | 11 May 2013
- Opera is moving to WebKit soon, so now we ready for that!
- Fixed a link to the documentation (moved to a new domain)

Version 2.0 | 23 Jan 2013
- Total reworking almoust from the ground up
- Even more powerful. Added support of new browsers, OS, layout engines, devices and other features
- New detection algorithm
- Now you can detect version of OS and layout engine with both CSS and JavaScript
- Updated demos
- New testing tool added (see Live preview)
- Replaced Firefox browser name from ”.mozilla” to ”.firefox”
- Replaced “ie” property to “msie” in JavaScript API (so now it’s browser.msie)
- Replaced Mac OS from ”.mac” to ”.macos”
- The same 4kb (minified)!