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
![Share on Facebook Facebook](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png)
![Share on Twitter twitter](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png)
![Share on Reddit reddit](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/reddit.png)
![Pin it with Pinterest pinterest](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/pinterest.png)
![Share on Linkedin linkedin](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png)
![Share by email mail](https://ictknowledge.net/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/mail.png)