Skip to content

Instantly share code, notes, and snippets.

@matylla
Forked from christopherdebeer/snippet.js
Created January 16, 2012 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matylla/1620214 to your computer and use it in GitHub Desktop.
Save matylla/1620214 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