On Mon, 2012-02-06 at 14:28 -0600, Donovan Brooke wrote:

> Paul M Foster wrote:
> > This is sort of obliquely related to PHP.
> >
> > I don't have a smart phone, but I need to know a couple of things:
> >
> > 1) Do smart phones use the same browsers as the desktop, or do they have
> > their own stripped down versions of browsers?
> >
> > 2) When a browser broadcasts its header telling the server what kind of
> > browser is involved, do they broadcast anything in the header to
> > indicate that they're being run on a smart phone?
> >
> > 3) Bonus question: Is there a preferred method amongst coders to
> > determine what type of environment is being browsed from, so as to serve
> > up the proper type of page (desktop or smart phone version of a
> > webpage)?
> >
> > Paul
> Hi Paul, I think this is a great PHP conversation.. and I don't 
> understand why GOTO threads always get way more replies than something 
> like this ;-)
> Diverse User Agent compatibility is going to be more and more of a 
> challenge for us.. gone are the days of a few known browsers that are 
> viewing our sites.  From bots, to browsers, to mobile devices, to game 
> UA's, to app UA's.., to IE's stubborn outlook on the web... the idea of 
> user experience is growing complicated! ;-)
> I really liked Mari's posted link to the "a list apart" blog about 
> "responsive web design" using "media query" (CSS).. however, it seems to 
> me that it takes the use of many languages and techniques in many cases 
> to get the job done... user agent serving (using PHP or JS or alike), 
> flexible CSS and web design, and a keen eye on your target audience may 
> all play apart.
> However, this is a PHP list.. and I think we can better approach this 
> topic by limiting our scope to talk about how PHP could be useful.
> My first question, being that my first language is not PHP, is; is their 
> any core PHP mobile detection functions/tools that exist?
> I have a running list of mobile UA's that I picked up somewhere that I 
> often use and edit to distribute content accordingly. I also have a PHP 
> mobile detection script that I picked up somewhere. I'm sure these 
> things can be found via google as well. The problem, as Mari's link 
> suggests, is that UA "list's" and browser sniffing scripts need 
> maintaining quite regularly, since mobile UA's are being added on a 
> weekly basis perhaps.
> Many of my projects do some PC UA (browser) sniffing.. especially for 
> IE., as IE has it's own system that it uses for how to render content.
> Anyway, I'm happy to share what I have.. but like I said, PHP is not my 
> first language, so I am interested to see what the more established 
> PHP'ers may have to say.
> Donovan
> -- 
> D Brooke

Keeping a PHP angle to this, have you looked at using an up-to-date
browscap.ini file with PHP? Basically, you can use that to read in the
raw user agent string from the browser, and it then finds a matching
entry in the ini file and gives you back some values about what it can
assume about that device, such as whether it is known to support Java
(although this is something you should be careful of, as it only tells
you if it's is supported, not if there is an available JVM), if it is a
mobile or search bot, what version of CSS it should support, etc. I use
it myself in a personal web stats script, and as long as you keep the
copy of the ini file recent, you should be OK.


Reply via email to