×Welcome aboard! We are happy you are here and wish you good net-raft!



Together We Can Simplify The World

the current number of solutions:  2379
.htaccess (1x)    AJAX (13x)    ANGULARJS (161x)    ASP (1x)    ASP.NET (6x)    BACKBONE.JS (47x)    BOOTSTRAP (12x)    C# (226x)    COFFEESCRIPT (28x)    CSS (71x)    HTML (47x)    JADE (34x)    JAVA (51x)    JAVASCRIPT (432x)    JQUERY (395x)    JQUERY MOBILE (5x)    JSON (5x)    LARAVEL (27x)    MYSQL (9x)    NODEJS (162x)    ORACLE SQL (19x)    PERL (2x)    PHP (302x)    PYTHON (10x)    REACT (62x)    RUBY (25x)    RUBY ON RAILS (1x)    SHELL (2x)    SQL (90x)    SQL SERVER (3x)    TYPESCRIPT (51x)    VB.NET (33x)    W3.CSS (6x)    W3.JS (40x)    
join us

click to create your account

ismobile express nodejs

(nodejs ismobile express )

- NODEJS

 viewed 25

Comment:
NODEJS

0

// at first you install "npm install express-useragent --save","npm install yamlparser --save","npm install request --save" in node.js command prompt

var express = require('express');

var app = express(),

useragent = require('express-useragent');

app.get('/', function(req, res){

var source = req.headers['user-agent'];

var info = useragent.parse(source);
var device = "";

if (info['isDesktop'] == true) {device = "desktop"}

else if (info['isMobile'] == true) {device = "mobile"}

else {device = "something else"}

res.send(device)
})

app.listen(3000);
console.log("Listening to Port 3000");

     

created: 5 months ago

The power of the user (%)

36%

Do you know a little more effective code ? Feel free to optimize ...


haven't you found what you're looking for ?
Write us your question ...
Login is not needed.


The most helpful NODEJS solutions
Likes Solution Technology
1.4K get user ipNODEJS
311 how to get client netmask using node.js ?NODEJS
272 how to get client local ip address using node.js ?NODEJS
239 How to combine node.js and jquery ?NODEJS
231 How to get client ip address using node.jsNODEJS
110 how to update a record in mysql using node.js ?NODEJS
108 how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?NODEJS
105 get client region using node.js ?NODEJS
101 get real user ip address using node.js?NODEJS
93 get client hostname using node.js ?NODEJS
Check out all of NODEJS ...
The most viewed NODEJS solutions by country
Solution Country
How to get client machine name and computer name with node.js?Cinque Terre
check if email is valid nodejsCinque Terre
How to get client machine name and computer name with node.js?Cinque Terre
How to get client ip address using node.jsCinque Terre
How to get client machine name and computer name with node.js?Cinque Terre
How to get client ip address using node.jsCinque Terre
create xlsx file nodejsCinque Terre
set session nodejsCinque Terre
download file from server nodejsCinque Terre
get latitude longitude node.jsCinque Terre