kharevbv
kharevbv

Reputation: 161

How can we identify the device type in HTTP layer

I am implementing a cache module, I receive several number of HTTP requests from different agents, I want to determine a particular request came from which device type. For example I want to make a distinction weather a request came from Nokia Lumia 920 or a iPhone 5s.

Upvotes: 1

Views: 92

Answers (1)

Evan Teran
Evan Teran

Reputation: 90573

I think the user agent string is the best you're gonna get... However, personally, I would not rely on this information for anything critical since devices can lie.

Ironically enough, I think the most common reason for a device to lie is that some sites will serve a crappier version of the content when they see certain user-agent strings!

I think your best bet is to use javascript to test for features instead of browsers. See http://modernizr.com/ for examples of enabling HTML5 stuff on a feature by feature basis using JS.

Upvotes: 3

Related Questions