Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2664 > unrolled thread

The prefered way to handle mobile apps?

Started bySimon <bad@example.com>
First post2011-07-28 09:51 +0200
Last post2011-07-28 18:37 -0400
Articles 10 — 6 participants

Back to article view | Back to comp.lang.php


Contents

  The prefered way to handle mobile apps? Simon <bad@example.com> - 2011-07-28 09:51 +0200
    Re: The prefered way to handle mobile apps? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-07-28 07:39 -0500
      Re: The prefered way to handle mobile apps? Michael Fesser <netizen@gmx.de> - 2011-07-28 15:23 +0200
        Re: The prefered way to handle mobile apps? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-07-28 10:21 -0500
      Re: The prefered way to handle mobile apps? legalize+jeeves@mail.xmission.com (Richard) - 2011-07-28 21:31 +0000
        Re: The prefered way to handle mobile apps? Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-28 19:53 -0400
      Re: The prefered way to handle mobile apps? Simon <bad@example.com> - 2011-07-29 08:33 +0200
        Re: The prefered way to handle mobile apps? Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-29 08:03 -0400
        Re: The prefered way to handle mobile apps? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-07-29 08:46 -0500
    Re: The prefered way to handle mobile apps? Norman Peelman <npeelman@cfl.rr.com> - 2011-07-28 18:37 -0400

#2664 — The prefered way to handle mobile apps?

FromSimon <bad@example.com>
Date2011-07-28 09:51 +0200
SubjectThe prefered way to handle mobile apps?
Message-ID<99cin5FioiU1@mid.individual.net>
Hi,

I would like to display my front page diferently for mobile users, (as 
well as a few other pages).

I see on the web that there are various scripts to detect mobile apps, 
(from the user agent).

But from experience those quickly get out of date or are simply buggy 
and return some false positive.

So my questions are simple, (I think).

Is there a sure fire way to dynamically detect mobile apps?
Is using php the right tool? or is there a more standard, 
(html/javascript), way of handling those.

I use appache, php 5.3.

Thanks in advance

Simon

[toc] | [next] | [standalone]


#2666

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2011-07-28 07:39 -0500
Message-ID<slrnj32m39.icc.hellsop@nibelheim.ninehells.com>
In reply to#2664
On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:
> Hi,
>
> I would like to display my front page diferently for mobile users, (as 
> well as a few other pages).
>
> I see on the web that there are various scripts to detect mobile apps, 
> (from the user agent).
>
> But from experience those quickly get out of date or are simply buggy 
> and return some false positive.
>
> So my questions are simple, (I think).
>
> Is there a sure fire way to dynamically detect mobile apps?

No. The user-agent value is what you've got to work with. Mostly, Real
Developers handle this by spending no small amount of time reading
documentation, experimenting, and testing with new devices and new OS
releases for those devices. People without a development budget adequate
for this kind of testing have to get by via reading the same doco, and
following discussions between those people that do that kind of testing
comparing notes. And, if one doesn't feel like sitting on one's hands
during those discussions, fixing the bugs in the detection routines
using the information others collect is a perfectly valid contribution.

> Is using php the right tool? or is there a more standard, 
> (html/javascript), way of handling those.

PHP would be a good tool, if there was such a sure-fire way.

-- 
When you have a thermic lance, everything looks like hours of fun.
                                       -- Christian Wagner in a.s.r

[toc] | [prev] | [next] | [standalone]


#2668

FromMichael Fesser <netizen@gmx.de>
Date2011-07-28 15:23 +0200
Message-ID<4ho2371oq3nc1f1ktj6lvdk1tn90d0q4um@mfesser.de>
In reply to#2666
.oO(Peter H. Coffin)

>On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:
>> Hi,
>>
>> I would like to display my front page diferently for mobile users, (as 
>> well as a few other pages).
>>
>> I see on the web that there are various scripts to detect mobile apps, 
>> (from the user agent).
>>
>> But from experience those quickly get out of date or are simply buggy 
>> and return some false positive.
>>
>> So my questions are simple, (I think).
>>
>> Is there a sure fire way to dynamically detect mobile apps?
>
>No. The user-agent value is what you've got to work with. Mostly, Real
>Developers handle this by spending no small amount of time reading
>documentation, experimenting, and testing with new devices and new OS
>releases for those devices.

A reason why browser sniffing is ugly, inefficient and unreliable.

Unfortunately in many cases it's most likely still the only way, because
many browser still don't support the better alternatives, like handheld
CSS and the new media queries in CSS 3.

Micha

-- 
http://mfesser.de/blickwinkel

[toc] | [prev] | [next] | [standalone]


#2670

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2011-07-28 10:21 -0500
Message-ID<slrnj32vkg.icc.hellsop@nibelheim.ninehells.com>
In reply to#2668
On Thu, 28 Jul 2011 15:23:29 +0200, Michael Fesser wrote:

> A reason why browser sniffing is ugly, inefficient and unreliable.
>
> Unfortunately in many cases it's most likely still the only way,
> because many browser still don't support the better alternatives, like
> handheld CSS and the new media queries in CSS 3.

There is always the option of composing a page to render well on any
sanely sized screen, and there's development tools to aid in this, but
that's well outside the scope of PHP.

-- 
This was, apparently, beyond her ken.  So far beyond her ken that she 
was well into barbie territory.
              -- J. D. Baldwin

[toc] | [prev] | [next] | [standalone]


#2671

Fromlegalize+jeeves@mail.xmission.com (Richard)
Date2011-07-28 21:31 +0000
Message-ID<j0skfj$cg8$2@news.xmission.com>
In reply to#2666
[Please do not mail me a copy of your followup]

"Peter H. Coffin" <hellsop@ninehells.com> spake the secret code
<slrnj32m39.icc.hellsop@nibelheim.ninehells.com> thusly:

>On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:

>> Is there a sure fire way to dynamically detect mobile apps?
>
>No. The user-agent value is what you've got to work with. [...]

Seems like there's an opportunity here for a web service where you
submit the user-agent on first page view and get back information
about the mobile device in question (or that its not a mobile device).
You can then cache this information in a cookie so that subsequent
page views don't go through the detection service as long as the user
agent text doesn't change.

That way the painful logic of identifying mobile devices could be
centralized into a single location and everyone would benefit.
-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

[toc] | [prev] | [next] | [standalone]


#2675

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-07-28 19:53 -0400
Message-ID<j0ssov$jse$1@dont-email.me>
In reply to#2671
On 7/28/2011 5:31 PM, Richard wrote:
> [Please do not mail me a copy of your followup]
>
> "Peter H. Coffin"<hellsop@ninehells.com>  spake the secret code
> <slrnj32m39.icc.hellsop@nibelheim.ninehells.com>  thusly:
>
>> On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:
>
>>> Is there a sure fire way to dynamically detect mobile apps?
>>
>> No. The user-agent value is what you've got to work with. [...]
>
> Seems like there's an opportunity here for a web service where you
> submit the user-agent on first page view and get back information
> about the mobile device in question (or that its not a mobile device).
> You can then cache this information in a cookie so that subsequent
> page views don't go through the detection service as long as the user
> agent text doesn't change.
>
> That way the painful logic of identifying mobile devices could be
> centralized into a single location and everyone would benefit.

Which only works if they go in through your entry page.  But if they've 
bookmarked (or clicked on a link) farther into your site, the cookie 
wouldn't be available.

So you'd need this information on every page anyway.  Why waste a 
cookie?  It won't be any more accurate and will just add to the amount 
of code (i.e. check to see if the cookie exists, and if not, check the 
user agent).

Peter's answer is good.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2677

FromSimon <bad@example.com>
Date2011-07-29 08:33 +0200
Message-ID<99f2ipFgb9U1@mid.individual.net>
In reply to#2666
On 2011/07/28 02:39 PM, Peter H. Coffin wrote:
> On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:
>> Hi,
>>
>> I would like to display my front page diferently for mobile users, (as
>> well as a few other pages).
>>
>> I see on the web that there are various scripts to detect mobile apps,
>> (from the user agent).
>>
>> But from experience those quickly get out of date or are simply buggy
>> and return some false positive.
>>
>> So my questions are simple, (I think).
>>
>> Is there a sure fire way to dynamically detect mobile apps?
>
> No. The user-agent value is what you've got to work with. Mostly, Real
> Developers handle this by spending no small amount of time reading
> documentation, experimenting, and testing with new devices and new OS
> releases for those devices. People without a development budget adequate
> for this kind of testing have to get by via reading the same doco, and
> following discussions between those people that do that kind of testing
> comparing notes. And, if one doesn't feel like sitting on one's hands
> during those discussions, fixing the bugs in the detection routines
> using the information others collect is a perfectly valid contribution.
>

Thanks for that.

Truth be told, my 2 main concerns are
1) false positves.
For example, Mobile_Detect 
(http://code.google.com/p/php-mobile-detect/), a very brief look at the 
bug list shows a fair amount of false positves.

2) The time spent at every page load to look if this is a mobile or not.

In the end, I might settle for $_SERVER['HTTP_X_WAP_PROFILE'] and/or 
$_SERVER['HTTP_ACCEPT'] (wap)

Thanks all

Simon

[toc] | [prev] | [next] | [standalone]


#2679

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-07-29 08:03 -0400
Message-ID<j0u7hp$idn$1@dont-email.me>
In reply to#2677
On 7/29/2011 2:33 AM, Simon wrote:
> On 2011/07/28 02:39 PM, Peter H. Coffin wrote:
>> On Thu, 28 Jul 2011 09:51:00 +0200, Simon wrote:
>>> Hi,
>>>
>>> I would like to display my front page diferently for mobile users, (as
>>> well as a few other pages).
>>>
>>> I see on the web that there are various scripts to detect mobile apps,
>>> (from the user agent).
>>>
>>> But from experience those quickly get out of date or are simply buggy
>>> and return some false positive.
>>>
>>> So my questions are simple, (I think).
>>>
>>> Is there a sure fire way to dynamically detect mobile apps?
>>
>> No. The user-agent value is what you've got to work with. Mostly, Real
>> Developers handle this by spending no small amount of time reading
>> documentation, experimenting, and testing with new devices and new OS
>> releases for those devices. People without a development budget adequate
>> for this kind of testing have to get by via reading the same doco, and
>> following discussions between those people that do that kind of testing
>> comparing notes. And, if one doesn't feel like sitting on one's hands
>> during those discussions, fixing the bugs in the detection routines
>> using the information others collect is a perfectly valid contribution.
>>
>
> Thanks for that.
>
> Truth be told, my 2 main concerns are
> 1) false positves.
> For example, Mobile_Detect
> (http://code.google.com/p/php-mobile-detect/), a very brief look at the
> bug list shows a fair amount of false positves.
>
> 2) The time spent at every page load to look if this is a mobile or not.
>
> In the end, I might settle for $_SERVER['HTTP_X_WAP_PROFILE'] and/or
> $_SERVER['HTTP_ACCEPT'] (wap)
>
> Thanks all
>
> Simon
>

You can only go so far with the false positives.  Unfortunately, it's 
not an exact science.

As for every page - you're prematurely optimizing.  The amount of time 
spent looking should not be significant, and is pretty much required for 
all pages (unless you want to lose customers by forcing them to jump 
through hoops).

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2680

From"Peter H. Coffin" <hellsop@ninehells.com>
Date2011-07-29 08:46 -0500
Message-ID<slrnj35edc.icc.hellsop@nibelheim.ninehells.com>
In reply to#2677
On Fri, 29 Jul 2011 08:33:59 +0200, Simon wrote:
> 2) The time spent at every page load to look if this is a mobile or not.
>
> In the end, I might settle for $_SERVER['HTTP_X_WAP_PROFILE'] and/or 
> $_SERVER['HTTP_ACCEPT'] (wap)

Well, you could set a cookie or a session var for what brower type to
expect, but that'd probably take LONGER than just handling the user
agent parsing. After a few page loads, all the data necessary to handle
the agent examination is probably cached (or could be cached at least),
and not really going to be looking a a whole lot of time to make the
determination anymore. Lots of work has already been done to make sure
that repeated operations take as little effort as possible, so you might
as well take advantage of that over writing more code to save very
little time.

-- 
32. I will not fly into a rage and kill a messenger who brings me bad 
   news just to illustrate how evil I really am. Good messengers are 
   hard to come by.
        --Peter Anspach's list of things to do as an Evil Overlord

[toc] | [prev] | [next] | [standalone]


#2674

FromNorman Peelman <npeelman@cfl.rr.com>
Date2011-07-28 18:37 -0400
Message-ID<j0soc4$mpe$1@dont-email.me>
In reply to#2664
On 07/28/2011 03:51 AM, Simon wrote:
> Hi,
>
> I would like to display my front page diferently for mobile users, (as
> well as a few other pages).
>
> I see on the web that there are various scripts to detect mobile apps,
> (from the user agent).
>
> But from experience those quickly get out of date or are simply buggy
> and return some false positive.
>
> So my questions are simple, (I think).
>
> Is there a sure fire way to dynamically detect mobile apps?
> Is using php the right tool? or is there a more standard,
> (html/javascript), way of handling those.
>
> I use appache, php 5.3.
>
> Thanks in advance
>
> Simon

http://wurfl.sourceforge.net/

-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web