Device Detector

jQuery Plugin

Make your Visitor Browser, Device and OS Name and Version available in Javascript

User Agent String

User Agent String

Browser

Version
Browser Version
Name
Browser Name
Id
Browser ID

Operating System

Version
OS Version
Version Major
OS Major Version
Version Minor
OS Minor Version
Version Bugfix
OS Bugfix Version
Name
OS Name
Id
OS ID
Version String
OS Version String
Version Categories
OS Version Categories

General

Supported
Mobile
Desktop

Apple

Safari
iPhone
iPad
iOS
MacOS

Google

Chrome
Android

Mozilla

Firefox

Microsoft

Internet Explorer
MSIE
Edge
IE Mobile
Windows Phone
Windows

Opera

Opera
Opera Mini

Blackberry

Blackberry

Other

Linux
BSD/Unix

getInfo() Object

                
              

NPM

installation
npm install js.device.detector --save

GIT

ZIP
https://github.com/exiguus/js.device.detector/archive/v1.0.3.zip
GZIP
https://github.com/exiguus/js.device.detector/archive/v1.0.3.tar.gz

Usage

  
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/js/device.detector/dist/jquery.device.detector.min.js"></script>
<script>
  // init
  var d = $.fn.deviceDetector;
  if (d.isDesktop()) {
    alert(
      'You are using ' +
      d.getBrowserName() +
      ' as Desktop Browser on ' +
      d.getOsName() +
      '.'
    );
  }
  console.log(d.getInfo());
  // return
  // {
  //     "browserVersion": 66,
  //     "browserName": "Google Chrome",
  //     "browserId": "chrome",
  //     "osVersion": "10_13_4",
  //     "osVersionString": "10_13_4",
  //     "osVersionCategories": {
  //         "major": 10,
  //         "minor": 13,
  //         "bugfix": 4
  //     },
  //     "osVersionMajor": 10,
  //     "osVersionMinor": 13,
  //     "osVersionBugfix": 4,
  //     "osName": "Apple Mac OS X",
  //     "osId": "macos",
  //     "supported": true,
  //     "mobile": false,
  //     "desktop": true,
  //     "safari": false,
  //     "iphone": false,
  //     "ipad": false,
  //     "ios": false,
  //     "macos": true,
  //     "chrome": true,
  //     "android": false,
  //     "firefox": false,
  //     "ie": false,
  //     "msie": false,
  //     "edge": false,
  //     "ieMobile": false,
  //     "windowsPhone": false,
  //     "windows": false,
  //     "opera": false,
  //     "operaMini": false,
  //     "blackberry": false,
  //     "linux": false,
  //     "bsd": false
  // }
</script>
  

Custom Usage


<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/js/device.detector/dist/jquery.device.detector.min.js"></script>
<script>
  // default browser matrix
  // {
  //   'supports': {
  //    'msie': {'id': 'msie', 'version': '11'},
  //    'edge': {'id': 'edge', 'version': '12'},
  //    'chrome': {'id': 'chrome', 'version': '66'},
  //    'firefox': {'id': 'firefox', 'version': '60'},
  //    'safari': {'id': 'safari', 'version': '11'},
  //  },

  // custom init

  $.fn.deviceDetector(
    {
      'supports': {
        'edge': {'id': 'edge', 'version': '12'},
        'chrome': {'id': 'chrome', 'version': '72'},
        'firefox': {'id': 'firefox', 'version': '68'},
      },
    }
  );
  var d = $.fn.deviceDetector;
  console.log(d.isSupported()) // return true or false
</script>

Public available Methods


'functions': {
  'public': {
    'getBrowserId': {
      'return': 'string',
    },
    'getBrowserName': {
      'return': 'string',
    },
    'getBrowserVersion': {
      'return': 'number',
    },
    'getInfo': {
      'return': 'object',
    },
    'getOsId': {
      'return': 'string',
    },
    'getOsName': {
      'return': 'string',
    },
    'getOsVersion': {
      'return': 'string',
    },
    'getOsVersionBugfix': {
      'return': 'number',
    },
    'getOsVersionCategories': {
      'return': 'object',
    },
    'getOsVersionMinor': {
      'return': 'number',
    },
    'getOsVersionMajor': {
      'return': 'number',
    },
    'getOsVersionString': {
      'return': 'string',
    },
    'isBlackberry': {
      'return': 'boolean',
    },
    'isBsd': {
      'return': 'boolean',
    },
    'isChrome': {
      'return': 'boolean',
    },
    'isDesktop': {
      'return': 'boolean',
    },
    'isEdge': {
      'return': 'boolean',
    },
    'isFirefox': {
      'return': 'boolean',
    },
    'isIe': {
      'return': 'boolean',
    },
    'isIeMobile': {
      'return': 'boolean',
    },
    'isIpad': {
      'return': 'boolean',
    },
    'isIphone': {
      'return': 'boolean',
    },
    'isLinux': {
      'return': 'boolean',
    },
    'isMacos': {
      'return': 'boolean',
    },
    'isMobile': {
      'return': 'boolean',
    },
    'isMsie': {
      'return': 'boolean',
    },
    'isOpera': {
      'return': 'boolean',
    },
    'isOperaMini': {
      'return': 'boolean',
    },
    'isSafari': {
      'return': 'boolean',
    },
    'isSupported': {
      'return': 'boolean',
    },
    'isWindows': {
      'return': 'boolean',
    },
    'isWindowsPhone': {
      'return': 'boolean',
    },
  },