Actually, checking the user-agent string against the device is the
wrong thing to do. What if Apple released an iTablet with Safari
tomorrow? Or what if they license Safari to another device
manufacturer? Then we'd all be back changing our code.
Instead, look for the words "Mobile" and "Safari." Apple has said that
these will always be in the Safari user-agent string for mobile devices.
if ((navigator.userAgent.indexOf('Mobile') != -1 &&
(navigator.userAgent.indexOf('Safari') != -1 {
// do stuff here
}
-- August
On Sep 14, 2007, at 5:52 PM, Greg McGuinness wrote:
>> The iPod Touch user agent string is similar to the iPhone except:
>> - it says "iPod" instead of "iPhone"
>> - AppleWebKit is 420.1 rather than 420+
>> - "3A100a" Safari rather than "1C28 Safari" on the iPhone.
>
> if ((navigator.userAgent.indexOf('iPhone') != -1) ||
> (navigator.userAgent.indexOf('iPod') != -1)) {
> document.location = "iphonerevu.htm";
> }
>
> I just posted this at:
> http://groups.google.com/group/iphonewebdev/browse_thread/thread/
> e12db4b239e6319d/db564932bfa220a6#db564932bfa220a6
>
> and have pictures of the new Developer Console at:
>
> http://www.iphoneapps.com/2007/09/ipod-touch-developer-debug-console.asp
>
>
> Greg McGuinness
> mailto:[EMAIL PROTECTED]
>
>
> On Sep 14, 2007, at 5:27 PM, Dennis Baldwin wrote:
>
>> I second that notion. I would love to know as well. For my iPhone
>> it looks like the following:
>>
>> Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+
>> (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3
>>
>> I'm wondering if the touch will have the "Mobile" part of the user
>> agent string or what the differentiation will be. If you do have a
>> touch feel free to go to:
>>
>> http://iphone.ublip.com/user_agent.php
>>
>> and post your results here.
>>
>> Thanks,
>> Dennis
>>
>>
>>
>> On 9/14/07, rich_wagner <[EMAIL PROTECTED]> wrote:
>>
>> Actually, thinking more about this...it seems like one would want
>> actually expect the platform string to be unique to each device in
>> order to differentiate between them. For example, you would not want
>> an iPod touch device to try a tel: link.
>>
>>
>> On Sep 14, 1:28 pm, rich_wagner < [EMAIL PROTECTED]> wrote:
>>> If anyone has an iPod touch, I am curious what the user agent is and
>>> whether "iPhone" appears in the platform string or whether it is
>>> specific to "iPod touch". My hunch is that they'll maintain 'iPhone"
>>> for consistency and since the Mobile Safari browser will surely be
>>> identical for both devices.
>>
>>
>>
>>>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---