Identifying the device requesting a response
-
02-07-2019 - |
Question
Is it possible for a web server to know which type of device request has been received from?
For example, can a create a website which shows different contents if request came from a computer (Firefox) and something different if it came from iPhone?
Solution
The way is the User Agent header, as has been said. You best use a list like this one to find out which mobile is it.
When I had to do something like it I stored the unknown received User Agents in a table to find out later about the ones I didn't have stored and thus wasn't able to know for sure what to serve.
OTHER TIPS
What Mitch said, with the caveat that it's possible to falsify ones user agent.
Check the User-Agent
in the Request Header
For full details on HTTP headers, see the specifications at http://www.w3.org/Protocols/.