+ 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 ?
4 ответов
+ 10
You can send the screen with through ejs or any other list Templete to your server and then to the database
+ 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.
+ 3
🐕Pradeep Simba 🐶 why do you want frontend to inform backend about the screen screen? For recording purposes on database?
+ 1
Try
var w = screen.width
console.log(w)
To get width of screen