Get Started

Installation

Npm
npm install joo-browser-detect --save
External
<script type="text/javascript" src="./node_modules/joo-browser-detect/dist/joo.min.js"></script>

Property

DetectObject
Property Description Sample
bot if browser is in bot, it will be true False
mobile if browser is in mobile environment, it will be true false
name a browser name firefox,chrome,ie
version browser or node version 50.0.0034, 1100
versionNumber browser or node number casted to number 50.0.0034, 11.00
os os type name Mac, Windows
ErrorObject
Property Description Sample
browser browser DetectObject
line line of line which error happend
column column of file which error happend
errorobject
url
message

Methods

Options Entry Output Description
name -- string name of library
version -- string version of a Joo library
init string this initialing the UserAgent
get -- DetectObject get browser detail
is String|Array, Function -- check browser detail(name and version)
error Function -- watch for any error on javascript
isOrError String|Array, Function -- check browser detail and watch for any error on javascript
Examples

Get browser information

            
const joo = require('joo-browser-detect');
console.log(joo.get());

//output
{
     "bot": false,
     "mobile": false,
     "name": "chrome",
     "version": "68.0.3440",
     "versionNumber": 68.0344,
     "os": "Windows 10"
}
            
          

Check browser

            
const joo = require('joo-browser-detect');
joo.is([
  'chrome > 70.0.3440',
  'firefox > 32',
  'ie > 10'
  ], is => {
    console.log( is ? 'Valid' : 'No Valid');
});
            
          

Watch When any error happend

            
const joo = require('joo-browser-detect');
joo.error( error => {
  console.log(error);
});
            
          

Issues