htmlnode.jsscreen-resolution

how to get the browser's screen resolution in the server end?


how to get the screen resolution of a device in nodejs?

i have read that using this <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> we can get the screen resolution. but my case is different. while user hitting the url there will not be any html file. then how to get the screen resolution?

is there any way to get it by req object? for example, i have

app.get('/', function(req, res){
   //req.getScreenResolution()
   res.redirect("/index.html");
});

thanks in advance


Solution

  • You can't get the screen resolution on the server side, you'll have to get it on the client side and pass it back to node with an ajax request/socket message.