tags:

views:

50

answers:

3

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?

+1  A: 

Check the User-Agent in the Request Header

For full details on HTTP headers, see the specifications at http://www.w3.org/Protocols/.

Mitch Wheat
+2  A: 

What Mitch said, with the caveat that it's possible to falsify ones user agent.

Mark Allen
Yes, as an authentication measure it sucks, but as an origin marker it works very well... the ones who fake it will probably do not complain when they get wrongly customized content
Vinko Vrsalovic
+2  A: 

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.

Vinko Vrsalovic