Hemant
Hemant

Reputation: 19846

Identifying the device requesting a response

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?

Upvotes: 1

Views: 196

Answers (3)

Vinko Vrsalovic
Vinko Vrsalovic

Reputation: 340526

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.

Upvotes: 2

Mark Allen
Mark Allen

Reputation: 1205

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

Upvotes: 2

Mitch Wheat
Mitch Wheat

Reputation: 300837

Check the User-Agent in the Request Header

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

Upvotes: 1

Related Questions