+ 2

How to get screen size of the client with nodejs ?

I will get the client's screen size in javascript with this method https://stackoverflow.com/questions/17359915/get-screen-resolution-on-a-mobile-website ? But , How to get screen size of the client with nodejs ?

30th May 2020, 4:36 PM
🐕Pradeep Simba 🐶
🐕Pradeep Simba 🐶 - avatar
4 ответов
+ 10
You can send the screen with through ejs or any other list Templete to your server and then to the database
1st Jun 2020, 11:00 AM
Coder
Coder - avatar
+ 3
At first GET route, onload get screen size use POST method to send to server in server, exists a POST route, which process the screen size, and render a page with the screen size processed result (Use a view template engine such as EJS) But this method increases server burden unnecessarily. Responsiveness should be handled at frontend with CSS media query.
31st May 2020, 5:10 AM
Gordon
Gordon - avatar
+ 3
🐕Pradeep Simba 🐶 why do you want frontend to inform backend about the screen screen? For recording purposes on database?
31st May 2020, 4:09 PM
Calviղ
Calviղ - avatar
+ 1
Try var w = screen.width console.log(w) To get width of screen
30th May 2020, 4:58 PM
Abhay
Abhay - avatar