#Mobile Device Detection via User Agent RegEx
Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.
I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.
The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".
Interestingly enough my research shows that /Mobile/ is more efficient than /iP(hone|od|ad)/ since it catches all Apple's device-specific Safari builds along with a slew of miscellaneous browsers. This also includes several Android builds, and Windows Mobile as well.
Note: I didn't bother with /i (case insensitive) on the RegExes below since user agents don't typically change the case they transmit.
This should have been obvious (and I'm just being nice to BlackBerry)
/Mobile|Android|BlackBerry/
/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile/
Includes barely significant outliers and third party browsers. Anything that doesn't make this cut probably can't render any website made past 2004 anyway.
/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/
####Google Reinforcing the /Mobile/ trick
####CakePHP 1.2
####CakePHP 2.0
####Symphony Extensions
- https://github.com/makenosound/mobiledevicedetection/tree/master/devices
- https://github.com/pixelninja/useragent_details (Whoa...)
- http://www.symfony-project.org/plugins/sfTeraWurflPlugin
- http://www.symfony-project.org/plugins/sfTIMdetectionPlugin
####Ruby / Rack
####Detect Desktop First (Flip the flop)
####User Agent Resources
- https://developer.mozilla.org/En/Gecko_user_agent_string_reference
- http://techpatterns.com/forums/about304.html
- http://techpatterns.com/downloads/firefox/useragentswitcher.xml
- http://www.useragentstring.com/pages/Mobile%20Browserlist/
- http://user-agents.org/
- http://www.zytrax.com/tech/web/mobile_ids.html
####Riffraff
ty for
isTablet
@GabrielDelepine