Skip to content

Lightweight plugin to get information about browser, version and OS

Notifications You must be signed in to change notification settings

alexphys/browser-detection

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

browser-detection Build Status

Lightweight package to get information about browser, version and OS.

Installation

$ bower install browserdetection --save

Usage

var data = browserDetection();

console.log(data.browser); // chrome
console.log(data.version); // 29
console.log(data.os); // osx

Possible values

  • 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

Add CSS classes to html tag

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;
}

Todo

  • More tests for...
  • osx
  • win
  • linux
  • mobile
  • Minification with grunt

About

Lightweight plugin to get information about browser, version and OS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.9%
  • HTML 2.1%