app.get('*', function (req, res) {
md = new MobileDetect(req.headers['user-agent']);
if (md.mobile() != null) {
res.writeHead(301,
{Location: 'http://m.gymbirds.com'}
);
res.end();
console.log('mobile');
}
else {
res.sendfile(__dirname + '/' + req.path);
console.log('desktop');
}
});
My Personal notes about IBM Bluemix, Techologies / Tools : AngularJS, NodeJs, grunt, bower, npm, yeoman, git, cloudfoundry
lundi 19 mai 2014
How to redirect on the mobile or desktop version ?
https://www.npmjs.org/package/mobile-detect
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire