express-useragent-exposer is a simple NodeJS/ExpressJS middleware user-agent exposer to your application and views created by Alexey Gordeyev and forked by Angel Custodio.
Installation is done using the Node Package Manager (npm). If you don't have npm installed on your system you can download it from npmjs.org To install express-useragent-exposer:
$ npm install express-useragent-exposer --save
Simple Node App
var http =useragent = ;var srv = http;srv;
var express = ;var app = ;var useragent = ;app;app;app;
Module provides details such as the following:
"isMobile": true"isDesktop": true"isBot": false..."browser": "Chrome""browserversion": "55.0.2883.79""os": "iOS""osversion": "10.2""source": "Mozilla/5.0 (iPad; CPU OS 10_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/55.0.2883.79"
Accessing the user-agent
If you are using
provides an easy way to access the user-agent as:
req.useragentfrom your app server
useragenthelper accessible from your
- Clone the repo:
git clone git://github.com/angelcustodio/express-useragent-exposer.git
- Or install with Bower:
bower install express-useragent-exposer.
The client side version of express-useragent-exposer available in the
Include file in your HTML – the minimum required for this plugin are:
Execute the plugin:
var userAgent = ;
Ensure you have nodeunit by running
npm install -g nodeunit.
npm installnpm test
Run example node app
npm run-script http
Run example express app
npm run-script express
Alexey Gordeyev (email@example.com)
Angel Custodio (firstname.lastname@example.org)
(The MIT License)
Copyright (c) 2012 Alexey Gordeyev email@example.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.