Answer the question
In order to leave comments, you need to log in
How to check screen width using php?
How to check screen width using php like media query?
Answer the question
In order to leave comments, you need to log in
Browsers don't send this information in requests. Just send the width to the server with javascript, and check it there.
If you need not an exact value, but an approximate one, then you can use the User Agent to make an assumption about the user's device and, accordingly, about the screen width. Of course, with a big error.
Library to help: https://github.com/WhichBrowser/Parser
If you really need it, then this:
the js page is loaded, it checks in localstorage a certain parameter in which bul. If false takes the screen size, writes to the session reloads the page and changes the parameter to true so that reloading only happens once, at the first login. Everything is now read in php session and data is taken from there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question