FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » The prefered way to handle mobile apps?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
The prefered way to handle mobile apps? [message #174971] Thu, 28 July 2011 07:51 Go to next message
Simon is currently offline  Simon
Messages: 29
Registered: February 2011
Karma: 0
Junior Member
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
Re: The prefered way to handle mobile apps? [message #174973 is a reply to message #174971] Thu, 28 July 2011 12:39 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
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
Re: The prefered way to handle mobile apps? [message #174975 is a reply to message #174973] Thu, 28 July 2011 13:23 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.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
Re: The prefered way to handle mobile apps? [message #174977 is a reply to message #174975] Thu, 28 July 2011 15:21 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
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
Re: The prefered way to handle mobile apps? [message #174978 is a reply to message #174973] Thu, 28 July 2011 21:31 Go to previous messageGo to next message
legalize+jeeves is currently offline  legalize+jeeves
Messages: 21
Registered: September 2010
Karma: 0
Junior Member
[Please do not mail me a copy of your followup]

"Peter H. Coffin" <hellsop(at)ninehells(dot)com> spake the secret code
<slrnj32m39(dot)icc(dot)hellsop(at)nibelheim(dot)ninehells(dot)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>
Re: The prefered way to handle mobile apps? [message #174982 is a reply to message #174971] Thu, 28 July 2011 22:37 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
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?-
Re: The prefered way to handle mobile apps? [message #174983 is a reply to message #174978] Thu, 28 July 2011 23:53 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/28/2011 5:31 PM, Richard wrote:
> [Please do not mail me a copy of your followup]
>
> "Peter H. Coffin"<hellsop(at)ninehells(dot)com> spake the secret code
> <slrnj32m39(dot)icc(dot)hellsop(at)nibelheim(dot)ninehells(dot)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(at)attglobal(dot)net
==================
Re: The prefered way to handle mobile apps? [message #174985 is a reply to message #174973] Fri, 29 July 2011 06:33 Go to previous messageGo to next message
Simon is currently offline  Simon
Messages: 29
Registered: February 2011
Karma: 0
Junior Member
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
Re: The prefered way to handle mobile apps? [message #174986 is a reply to message #174985] Fri, 29 July 2011 12:03 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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(at)attglobal(dot)net
==================
Re: The prefered way to handle mobile apps? [message #174987 is a reply to message #174985] Fri, 29 July 2011 13:46 Go to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: *WHAT IS ISLAM ?*
Next Topic: Sort an array by value type. Where do I start :)??
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 08:09:46 GMT 2024

Total time taken to generate the page: 0.02438 seconds