Welcome aboard! We are happy you are here and wish you good net-raft!
// at first you install "npm install express-useragent --save" in node.js command prompt
// this put into browser.js
var http = require('http')
, useragent = require('express-useragent');
var srv = http.createServer(function (req, res) {
ua = req.headers['user-agent'];
useragent = ua;
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(useragent);
});
srv.listen(3000);
console.log("Listening to Port 3000");
// then put this url http://localhost:3000/browser into any browser
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 8.2K 1.7K