Detect Browser, Device and OS With jQuery - js.device.detector

Detect Browser, Device and OS With jQuery - js.device.detector
File Size: 12.3 MB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Yet another jQuery plugin used to detect browser, devices, OS and other useful information for web & mobile developers.

The plugin also enables you to submit a Browser Matrix to validate supported Browser.

See also:

How to use it:

1. Include the js.device.detector script after you've include the latest jQuery.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous"></script>
<script src="dist/jquery.device.detector.js"></script>

2. Initialize the js.device.detector.

var instance = $.fn.deviceDetector;

3. Get the current browser, device, OS you're using.

instance.getInfo();

4. This will return an object as these:

{
  Android: false
  blackberry: false
  browserId: "chrome"
  browserName: "Google Chrome"
  browserVersion: 67
  bsd: false
  chrome: true
  desktop: true
  edge: false
  firefox: false
  ie: false
  ieMobile: false
  ios: false
  ipad: false
  iphone: false
  linux: false
  macos: false
  mobile: false
  msie: false
  opera: false
  operaMini: false
  osId: "windows10"
  osName: "Microsoft Windows 10"
  osVersion: "10.0"
  osVersionBugfix: 0
  osVersionCategories: {major: 10, minor: 0, bugfix: 0}
  osVersionMajor: 10
  osVersionMinor: 0
  osVersionString: "10.0"
  safari: false
  supported: true
  windows: true
  windowsPhone: false
}

5. API.

  • getBrowserId
  • getBrowserName
  • getBrowserVersion
  • getInfo
  • getOsId
  • getOsName
  • getOsVersion
  • getOsVersionBugfix
  • getOsVersionCategories
  • getOsVersionMinor
  • getOsVersionMajor
  • getOsVersionString

6. Available validators.

  • isAndroid
  • isBlackberry
  • isBsd
  • isChrome
  • isDesktop
  • isEdge
  • isFirefox
  • isIe
  • isIeMobile
  • isIpad
  • isIphone
  • isLinux
  • isMacos
  • isMobile
  • isMsie
  • isOpera
  • isOperaMini
  • isSafari
  • isSupported
  • isWindows
  • isWindowsPhone

Changelog:

v1.0.1 (2018-07-29)

  • fix potential security vulnerability found in the serve dependency

This awesome jQuery plugin is developed by exiguus. For more Advanced Usages, please check the demo page or visit the official website.