Re: Headers on smart phone browsers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 06, 2012 at 09:02:34PM +0000, Ashley Sheridan wrote:

[snip]

> 
> 
> 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.

The issue with this (according to the get_browser() docs) is that the
browsecap file is 300K long, will get longer, and significantly slows
loading of your applications. Moreover, the parsing of the UA string and
other data is far more extensive than anything I'd want or could use.
The only thing I'd want to know is whether I'm serving pages to a
handheld or desktop device.

>From what I've seen, pages built for handheld devices (see, for example,
yahoo.mobi) are considerably stripped down, often with no CSS styling.
For now, if I have to make the decision on whether to serve up desktop
or handheld versions of a page, all I want to know is a yes or no answer
to the question of, "Is this a handheld?" The native PHP get_browser()
function appears to be overkill for that, and may, in fact be
insufficient.

That was the origin of the original questions-- was there some
definitive way of knowing the platform when the page request came in.
And from all the research I've done, the answer is, "No". The UA string
may not work as intended. There are javascript sniffers and CSS
triggers, but neither are they definitive. For example, the CSS
triggers test for resolution or screen width or the like. This is fine,
so long as handhelds remain at crappy resolutions. But I don't expect
that to be the case forever. 

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux