On Thu, Jun 13, 2013 at 3:17 AM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx>wrote: > On Wed, Jun 12, 2013 at 04:19:50PM -0700, dealTek wrote: > > > Hi all, > > > > I'm curious of a simple, common, universal way to detect a mobile user > so I can redirect them to a mobile directory... > > > > What is best for this: Javascript - CSS - PHP? > > > > I think for my purposes if I can detect screen size or mobile browser > agent - that would be good enough for what I need right now. > > This is not really a PHP question. I understand your asking it, though. > Does anyone know of a better list or whatever for generic web designer > questions? > > To your question, there are two problems: 1) Looking for a browser > signature is a needle/haystack proposition, and the haystack is > enormous, and it gets bigger every time a new phone/tablet model comes > out; 2) Screen size used to be a good indicator, but as I feared when > people first started using screen resolution as the main indicator, the > screens on mobile devices have become progressively more and more > capable. Some of them are better than many desktops I've seen. > > So I'd be interested in the answer to the question myself. > > Paul > > HI, Even though the list gets bigger, there aren't that many mobile operating systems. Any Android device will have Android in it's user agent, and iPhone as iPhone in the User Agent string. If you want to check for tablets, you can check for iPad specifically (it is in the user agent), and for Android, I believe that mobile devices have 'Mobile' in the user agent string, and tablets don't. Then there is ofcourse the small 1 percent or so Blackberry & WP users, which can probably be detected easily too with their user agent. Cheers, Matijn