Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
Well, there's no way around it, you'll need to browser sniff if you're going to detect mobile. If you're ONLY going to target the iPhone, maybe there's a way around it, but since it is technically Safari, and follows almost all of the same rules, there's probably not.
Browser sniffing is only frowned on in JavaScript development because it is supposed to be better to do feature testing when implementing certain code, such as using document.querySelectorAll only on browsers that support it. Feature testing is a more flexible approach because it doesn't rely on knowing every possibility that is out there. If you need to change your entire website because you're serving to mobile, browser sniffing is definitely the way to go, especially since some people have worked out a majority of the possibilities ahead of time, but it will probably need to be updated as more mobile browsers are pumped in the system.
Browser sniffing is usually done from the server anyway, not with JavaScript.
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
Last edited by wayfarer07; 03-20-2010 at 12:10 PM..
|