Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How does a website detect whether http requests are comming from a mobile device or not? In my mind, it's all just TCP/IP packets with a standard address/port header right? Is this a hardware/routing thing? Is it the hosting service like Apache? What does one need to know to prepare a website for mobile redirection?

share|improve this question

closed as off topic by John Gardeniers, Tom O'Connor, Zoredache, voretaq7, MDMarra Feb 5 '12 at 14:59

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
For the future this would be a better question for Webmasters.SE than us :) –  voretaq7 Jan 14 '12 at 5:41

2 Answers 2

up vote 6 down vote accepted

Generally speaking, this is most likely done by inspecting the HTTP-User-Agent that is sent in the HTTP request. http://en.wikipedia.org/wiki/User_agent has more information. Mobile safari sends a different string that the web page can investigate (via js/php/etc), and then serve different content, or change the stylesheet, or send them to a different page. Also, server data compression can be quite useful in general, but especially for mobile devices, especially because many mobile broadband connections are quite slow. So the server will also use optimization techniques for data, again especially helpful for mobile clients.

share|improve this answer
    
Bingo. A ready-made script for doing this is available at detectmobilebrowsers.com –  ceejayoz Dec 15 '11 at 21:05
    
That more than explains it. Thank you so much guys. –  hydroparadise Dec 15 '11 at 21:15

To expand on the other answer, You can utilize a database such as WURFL that contains browser agent strings (As well as device capabilities)

share|improve this answer
    
+1 for WURFL - very comprehensive for those looking for dynamic mobile experiences. –  thinice Dec 15 '11 at 23:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.