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

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.

You cannot get screen resolution of client on server, from a page request. If you are trying to do a redirect based on window size then you can do this.

  1. Make your landing page simple for all resolution, so that browser must display it.
  2. Detect the window resolution and then redirect to the desired page via JavaScript in the page. See here
  3. Set cookie for window resolution, for further use.