The package express-useragent gives much of the details
npm install express-useragent
The usage is like below
var express = require('express');
var app = express();
var useragent = require('express-useragent');
app.use(useragent.express());
app.get('/', function(req, res){
res.send(req.useragent);
});
app.listen(3000);
The result is like this below, pretty useful. In this sample, the geoIP is coming as empty however.
{ isAuthoritative: true,
isMobile: false,
isTablet: false,
isiPad: false,
isiPod: false,
isiPhone: false,
isAndroid: false,
isBlackberry: false,
isOpera: false,
isIE: false,
isEdge: false,
isIECompatibilityMode: false,
isSafari: false,
isFirefox: false,
isWebkit: false,
isChrome: true,
isKonqueror: false,
isOmniWeb: false,
isSeaMonkey: false,
isFlock: false,
isAmaya: false,
isPhantomJS: false,
isEpiphany: false,
isDesktop: true,
isWindows: false,
isLinux: false,
isLinux64: false,
isMac: true,
isChromeOS: false,
isBada: false,
isSamsung: false,
isRaspberry: false,
isBot: false,
isCurl: false,
isAndroidTablet: false,
isWinJs: false,
isKindleFire: false,
isSilk: false,
isCaptive: false,
isSmartTV: false,
isUC: false,
isFacebook: false,
isAlamoFire: false,
silkAccelerated: false,
browser: 'Chrome',
version: '74.0.3729.169',
os: 'macOS High Sierra',
platform: 'Apple Mac',
geoIp: {},
source:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' }
References:
https://www.npmjs.com/package/express-useragent
npm install express-useragent
The usage is like below
var express = require('express');
var app = express();
var useragent = require('express-useragent');
app.use(useragent.express());
app.get('/', function(req, res){
res.send(req.useragent);
});
app.listen(3000);
The result is like this below, pretty useful. In this sample, the geoIP is coming as empty however.
{ isAuthoritative: true,
isMobile: false,
isTablet: false,
isiPad: false,
isiPod: false,
isiPhone: false,
isAndroid: false,
isBlackberry: false,
isOpera: false,
isIE: false,
isEdge: false,
isIECompatibilityMode: false,
isSafari: false,
isFirefox: false,
isWebkit: false,
isChrome: true,
isKonqueror: false,
isOmniWeb: false,
isSeaMonkey: false,
isFlock: false,
isAmaya: false,
isPhantomJS: false,
isEpiphany: false,
isDesktop: true,
isWindows: false,
isLinux: false,
isLinux64: false,
isMac: true,
isChromeOS: false,
isBada: false,
isSamsung: false,
isRaspberry: false,
isBot: false,
isCurl: false,
isAndroidTablet: false,
isWinJs: false,
isKindleFire: false,
isSilk: false,
isCaptive: false,
isSmartTV: false,
isUC: false,
isFacebook: false,
isAlamoFire: false,
silkAccelerated: false,
browser: 'Chrome',
version: '74.0.3729.169',
os: 'macOS High Sierra',
platform: 'Apple Mac',
geoIp: {},
source:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' }
References:
https://www.npmjs.com/package/express-useragent
No comments:
Post a Comment