You cannot determine the size of the viewport on the server; you need to do this on the client side.
Forwarding on the client side may not be the best solution, as it is difficult and harmful to search engines. Instead, you can use media queries to apply different stylesheets (or cascades) designed for different ranges of screen resolutions without server-side interaction.
David source share