Install mobile detect module on your nodejs server (place yourself on the root where your node_modules folder is and type
1 |
npm install mobile-detect |
then on your server node.js code type
1 2 |
var MobileDetect = require('mobile-detect'), md = new MobileDetect(req.headers['user-agent']); |
1 2 3 4 5 |
if (md.mobile()) { // launch mobile view } else { // launch desktop view } |
https://www.npmjs.com/package/mobile-detect