{"_id":"sniffr","_rev":"455589","name":"sniffr","description":"Browser, os and device detection","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"time":{"modified":"2021-08-05T07:23:42.000Z","created":"2014-08-04T23:13:40.861Z","1.2.0":"2018-12-12T20:38:55.745Z","1.1.4":"2016-02-09T20:38:44.096Z","1.1.3":"2016-01-27T22:15:22.008Z","0.1.2":"2015-11-08T14:53:08.523Z","0.1.1":"2014-08-04T23:13:40.861Z"},"users":{"mrdain":true,"jugaltheshah":true,"yonisetiawan":true,"xinwangwang":true},"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"repository":{"type":"git","url":"git+https://github.com/antivanov/sniffr.git"},"versions":{"1.2.0":{"name":"sniffr","version":"1.2.0","description":"Browser, os and device detection","main":"src/sniffr.js","scripts":{"lint":"eslint src/* spec/*","test":"karma start karma.conf.js","test:tdd":"karma start karma.conf.js --tdd","concat":"concat -o dist/sniffr.js src/modern.js.polyfill.js src/sniffr.js","uglify":"uglifyjs --compress --mangle --output dist/sniffr.min.js -- dist/sniffr.js","dist":"npm run concat && npm run uglify"},"repository":{"type":"git","url":"git+https://github.com/antivanov/sniffr.git"},"keywords":["browser detection","os detection","device detection","sniffing","detection","recognition","browser","os","device"],"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"license":"MIT","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"devDependencies":{"chai":"^4.2.0","concat":"^1.0.3","eslint":"^5.10.0","karma":"^3.1.3","karma-chrome-launcher":"^2.2.0","karma-mocha":"^1.3.0","karma-spec-reporter":"0.0.32","mocha":"^5.2.0","mocha-html-reporter":"0.0.1","uglify-js":"^3.4.9"},"homepage":"https://github.com/antivanov/sniffr","gitHead":"10b71ff265416c9350f054ad36ebc944094b5863","_id":"sniffr@1.2.0","_npmVersion":"6.5.0","_nodeVersion":"10.4.1","_npmUser":{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"},"dist":{"shasum":"d4e31073ef4f7c00d87dba89289736fba25cadb4","size":4205,"noattachment":false,"key":"/sniffr/-/sniffr-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sniffr/download/sniffr-1.2.0.tgz"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sniffr_1.2.0_1544647135656_0.75625280908973"},"_hasShrinkwrap":false,"publish_time":1544647135745,"_cnpm_publish_time":1544647135745},"1.1.4":{"name":"sniffr","version":"1.1.4","description":"Browser, os and device detection","main":"src/sniffr.js","files":["src/sniffr.js","LICENSE","README.md"],"repository":{"type":"git","url":"git+https://github.com/antivanov/sniffr.git"},"keywords":["browser detection","os detection","device detection","sniffing","detection","recognition","browser","os","device"],"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"license":"MIT","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"devDependencies":{"bower":"~1.3.2","express":"^4.13.4","grunt":"~0.4.4","grunt-cli":"~0.1.13","grunt-contrib-concat":"~0.5.0","grunt-contrib-jasmine":"~0.9.2","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.1"},"homepage":"https://github.com/antivanov/sniffr","scripts":{"test":"grunt lint test"},"gitHead":"97b47bc9cf37593b9362d383adf2808ace95d9da","_id":"sniffr@1.1.4","_shasum":"c57fa9fc1e8fccc47432be3764ca33b79698e0e8","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"},"dist":{"shasum":"c57fa9fc1e8fccc47432be3764ca33b79698e0e8","size":4050,"noattachment":false,"key":"/sniffr/-/sniffr-1.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/sniffr/download/sniffr-1.1.4.tgz"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/sniffr-1.1.4.tgz_1455050322483_0.8168744486756623"},"directories":{},"publish_time":1455050324096,"_cnpm_publish_time":1455050324096,"_hasShrinkwrap":false},"1.1.3":{"name":"sniffr","version":"1.1.3","description":"Browser, os and device detection","main":"src/sniffr.js","files":["src/sniffr.js","LICENSE","README.md"],"repository":{"type":"git","url":"git+https://github.com/antivanov/sniffr.git"},"keywords":["browser detection","os detection","device detection","sniffing","detection","recognition","browser","os","device"],"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"license":"MIT","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"devDependencies":{"bower":"~1.3.2","express":"^4.13.4","grunt":"~0.4.4","grunt-cli":"~0.1.13","grunt-contrib-concat":"~0.5.0","grunt-contrib-jasmine":"~0.9.2","grunt-contrib-jshint":"~0.10.0","grunt-contrib-uglify":"~0.5.1"},"homepage":"https://github.com/antivanov/sniffr","scripts":{"test":"grunt lint test"},"gitHead":"9378bd849a1bab250a9958eaac6c90581b5cdd27","_id":"sniffr@1.1.3","_shasum":"401d64b171a674670bf9e6d89df171f5ca5635b7","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"},"dist":{"shasum":"401d64b171a674670bf9e6d89df171f5ca5635b7","size":4042,"noattachment":false,"key":"/sniffr/-/sniffr-1.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/sniffr/download/sniffr-1.1.3.tgz"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"directories":{},"publish_time":1453932922008,"_cnpm_publish_time":1453932922008,"_hasShrinkwrap":false},"0.1.2":{"name":"sniffr","version":"0.1.2","description":"Browser, os and device detection","main":"src/sniffr.js","files":["src/sniffr.js","LICENSE","README.md"],"repository":{"type":"git","url":"git+https://github.com/antivanov/sniffr.git"},"keywords":["browser detection","os detection","device detection","sniffing","detection","recognition","browser","os","device"],"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"license":"MIT","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"devDependencies":{"grunt":"~0.4.4","grunt-cli":"~0.1.13","grunt-contrib-jshint":"~0.10.0","grunt-contrib-jasmine":"~0.9.2","grunt-contrib-uglify":"~0.5.1","grunt-contrib-concat":"~0.5.0","bower":"~1.3.2"},"homepage":"https://github.com/antivanov/sniffr","scripts":{"test":"grunt lint test"},"gitHead":"02327f95380bd30d9d0a808ade5180f16acaf5a3","_id":"sniffr@0.1.2","_shasum":"19be58c74526bac4e54c90baf095988ed5d289e5","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"},"dist":{"shasum":"19be58c74526bac4e54c90baf095988ed5d289e5","size":3990,"noattachment":false,"key":"/sniffr/-/sniffr-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/sniffr/download/sniffr-0.1.2.tgz"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"directories":{},"publish_time":1446994388523,"_cnpm_publish_time":1446994388523,"_hasShrinkwrap":false},"0.1.1":{"name":"sniffr","version":"0.1.1","description":"Browser, os and device detection","main":"src/sniffr.js","files":["examples/node_example.js","src/sniffr.js","LICENSE","README.md"],"repository":{"type":"git","url":"https://github.com/antivanov/sniffr.git"},"keywords":["browser detection","os detection","device detection","sniffing","detection","recognition","browser","os","device"],"author":{"name":"Anton Ivanov","email":"anton.al.ivanov@gmail.com","url":"https://github.com/antivanov"},"license":"MIT","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"devDependencies":{"grunt":"~0.4.4","grunt-cli":"~0.1.13","grunt-contrib-jshint":"~0.10.0","grunt-contrib-jasmine":"~0.6.5","grunt-contrib-uglify":"~0.5.1","grunt-contrib-concat":"~0.5.0","bower":"~1.3.2"},"homepage":"https://github.com/antivanov/sniffr","scripts":{"test":"grunt lint test"},"gitHead":"790756d05fb89bbe2aa02475ddf268a99087f91f","_id":"sniffr@0.1.1","_shasum":"28bdd1df1cfa376b116ee0188105cdf824ad19e1","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"},"maintainers":[{"name":"ant-ivanov","email":"anton.al.ivanov@gmail.com"}],"dist":{"shasum":"28bdd1df1cfa376b116ee0188105cdf824ad19e1","size":3986,"noattachment":false,"key":"/sniffr/-/sniffr-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sniffr/download/sniffr-0.1.1.tgz"},"directories":{},"publish_time":1407194020861,"_cnpm_publish_time":1407194020861,"_hasShrinkwrap":false}},"readme":"<img src=\"http://publicdomainvectors.org/photos/bastiyxc_schn_ffelhund.png\" alt=\"sniff-sniff...\" width=\"150px\" height=\"100px\"/>\n\n# Sniffr [![Build Status](https://travis-ci.org/antivanov/sniffr.svg?branch=master)](https://travis-ci.org/antivanov/sniffr)\n\nBrowser, OS and device detection based on the available user agent string.\n\n>it's very rarely a good idea to use user agent sniffing. You can almost always find a better, more broadly compatible way to solve your problem! [MDN: Browser detection using the user agent](https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent)\n\n## Why use it\n\nIn case some browser-specific issue cannot be fixed uniformly across the browsers we may need to perform (sad gasp) some browser detection. For example, browser X crashes when function Y from library Z is used, so we have to detect when we are dealing with browser X and disable library Z.\n\nAnother legitimate case is when we want to know what browsers, os and devices are most frequently used when our site is accessed. Then we can just analyze the user agent string sent in HTTP request headers on a server side. As a minor variation, alternatively, we can perform the user agent string analysis on the client side and send to the server only the results.\n\n## What is recognized\n\n### Browsers\n\n* Firefox\n* Internet Explorer\n* Edge\n* Chrome\n* Opera\n* Safari\n* Android Browser\n* BlackBerry Browser\n* Opera mini\n\n### Operating Systems\n\n* Windows\n* Linux\n* Mac OS\n* iOS\n* Blackberry OS\n* OpenBSD\n* Android\n* Firefox OS\n* Windows Phone\n* Windows Mobile\n\n### Devices\n\n* iPad\n* iPhone\n* Galaxy\n* HTC\n* Nexus\n* Nokia\n* Lumia\n* Blackberry\n* XBox\n\n## Installation\nTo install the library use Bower:\n\n``` javascript\nbower install sniffr\n```\n\nReady to use library is available in the _dist_ folder.\n\n## How to use\n\nThe library is meant to be used only in a browser, no server-side code is run. Include the library:\n\n```html\n<script src=\"bower_components/dist/sniffr.min.js\" />\n```\n\nafter the script has loaded the object ```Sniffr``` is available and can be used in the client code.\n\nExample:\n\n```javascript\n//If Windows and Firefox 28 or later\nif (Sniffr.os.name === \"windows\"\n  && Sniffr.browser.name === \"firefox\" && Sniffr.browser.version[0] >= 28) {\n  //Apply some workaround\n}\n```\n\nExample:\n\n```javascript\n//Sending user browser and os information to the server for further analysis\nStats.send(Sniffr.os, Sniffr.browser, Sniffr.device);\n```\n\n## API\n\n`Sniffr.os`: operating system\n\n`Sniffr.browser`: browser\n\n`Sniffr.device`: device\n\n`Sniffr.sniff` : function that expects a user agent string as an argument, it is called automatically in a browser\n\n## Server side\n\nSniffr can also be used in a Node.js environment in case you need to do some server-side user agent analysis as well.\n\nFirst install it\n\n`npm install sniffr`\n\nThen load the module, provide it the agent string and query the results just like in a browser environment:\n\n```javascript\nvar Sniffr = require(\"sniffr\");\nvar s = new Sniffr();\n\ns.sniff(\"Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25\");\n\nconsole.log(\"Operating System:\");\nconsole.log(s.os);\nconsole.log(\"Browser:\");\nconsole.log(s.browser);\nconsole.log(\"Device:\");\nconsole.log(s.device);\n```\n\n## Other libraries\n\nSome libraries like _jQuery_ provide only browser information and not the OS information. Some like _Detectizr_ are plugins for other libraries that you may not use. And some require server-side code. A few libraries are usable only on the server side or only in a browser.\n\n_Sniffr_ provides simple and symmetric API, does not depend on other libraries, does not require the server part, is tiny, fast and easily extensible. In addition, it can be used either in a browser environment and on the server side.\n\n## Credits\n\nThe original sniffing dog image location is http://publicdomainvectors.org/en/free-clipart/Dog-sniffing-vector-image/11807.html\n","_attachments":{},"homepage":"https://github.com/antivanov/sniffr","bugs":{"url":"https://github.com/antivanov/sniffr/issues"},"license":"MIT"}