Eun Bit Hwang
Eun Bit Hwang

Reputation: 151

detecting cordova device on express.js server

Hi I'm new to Cordova aka PhoneGap. I already made an express.js website and trying to build ios and android app using Cordova.

thus, there is one website. and there are 3 way(ios app, android app and web browser) to approach that.

I want to figure out what approach is and provide different layout in express routes.

In http header android device sent 'x-requested-with': 'com.example.hello' but iOS does not. In client js can use loacation.href but in express.js cannot read the location.href.

Is there any way to figure out the type of approach in express.js?

Upvotes: 0

Views: 400

Answers (2)

Mohammad Abdullah
Mohammad Abdullah

Reputation: 31

try this jxcore , it might be useful to your project !! ^_^

[https://www.sitepoint.com/how-to-run-node-js-with-express-on-mobile-devices/]

Upvotes: -2

Gilberto Avalos
Gilberto Avalos

Reputation: 512

app.get('/', function(req, res){
  // console.log(req.headers);
  console.log('User-Agent: ' + req.headers['user-agent']);
});

Upvotes: 0

Related Questions