Lightweight package to get information about browser, version and OS.
$ bower install browserdetection --save
var data = browserDetection();
console.log(data.browser); // chrome
console.log(data.version); // 29
console.log(data.os); // osx
- data.browser:
ie
,chrome
,firefox
,safari
,opera
- data.version: depends on the browser
- data.os:
mac
,win
,linux
,freebsd
,mobile
,iphone
,ipod
,ipad
,android
,blackberry
,j2me
,webtv
Javascript:
browserDetection({
addClasses: true
});
CSS:
html{
background: white;
}
/* Internet Explorer 7 specific */
html.ie-7{
background: red;
}
/* Only for OSX users with firefox */
html.osx.firefox{
background: blue;
}
- More tests for...
- osx
- win
- linux
- mobile
- Minification with grunt