I was having a discussion at work today about using both media queries and targeting different mobile OSes via user agent detection by way of javascript and body classes.
My coworker said we should never use user agent detection via javascript for css, ie appending the OS of a device to the body as a class along with browser, and instead we should create a media query for each mobile device and fix any OS specific issues that way. He said we wouldn't be able to capture the nuance of each devise without doing so.
I responded that screen resolutions are quickly changing and at some point an iOS device was going to be the same resolution as an Android device, if it hasn't already happened. This means it will become hard to address OS domain specific issues if the media queries at some point start bleeding into one another. That a better solution would be to find just a few natural break points for the media queries and then deal with OS specific issues via user agent detection css declarations.
Not to mention that is a lot of different possible devices to target, and that a new device with a new resolution would cause us to have to add a whole new set of media queries. I reiterated that a more general, and dry solution, would be better.
I also pointed that that some issues are in the domain of the device dimensions, grid objects resizing, general font size changes, and spacing differences that come from the last two.
Other issues though fall in the domains of OS related issues. For instance in iOS you can control the amount of text zoom going on via, ‑webkit‑text‑size‑adjust, but in Android the problem isn't as simple, though you can try to hack your way through things.
At that point it was closing time and we deiced to shelve the discuss until tomorrow. He seemed pretty insistent that my idea to use user agent classes on the body was a bad idea though and said he would explain further tomorrow. Being slightly OCD I went home and started googling, but ended up not finding much information besides a few articles saying to use media queries over user agent detection, but nothing about using user agent detection along with media queries.
Am I missing some large pitfalls, or holes in my logic here? Is there some edge cases where user agent detection fails to identify correctly in a way that would prevent me from address an OS specific issue? Or are the implementation of Android so different that I really have no choice but to target each device individual via media queries?