Skip to content

Instantly share code, notes, and snippets.

@ymichael
Forked from christopherdebeer/snippet.js
Created April 3, 2012 16:39
Show Gist options
  • Save ymichael/2293465 to your computer and use it in GitHub Desktop.
Save ymichael/2293465 to your computer and use it in GitHub Desktop.
Node.js Express - Mobile detection
app.get('/', function(req, res){
var ua = req.header('user-agent');
if(/mobile/i.test(ua)) {
res.render('mobile.html');
} else {
res.render('desktop.html');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment