Version 1 and Version 2 are pretty much equivalent, except 2 is case
insensitive. I'd go with 2, if only because it is case insensitive,
but it is unlikely to matter.
Version 3 could use some sort of test for iPhone-only capabilities. I
don't have any idea off the top of my head, however.
On Wed, Dec 3, 2008 at 10:08 PM, brente <[EMAIL PROTECTED]> wrote:
>
> Hello All. I see people detecting the iPhone/iPod mobile Safari in
> different ways. Which is the best and why?
>
> Version 1
> if ((navigator.userAgent.indexOf('iPhone') != -1) ||
> (navigator.userAgent.indexOf('iPod') != -1))
>
> Version 2
> if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match
> (/iPod/i)))
>
> Version 3
> something else than userAgent?
>
>
> Thank you.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---