Anyone know the iPod touch user agent?

1,771 views
Skip to first unread message

rich_wagner

unread,
Sep 14, 2007, 1:28:24 PM9/14/07
to iPhoneWebDev
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.

rich_wagner

unread,
Sep 14, 2007, 1:40:05 PM9/14/07
to iPhoneWebDev
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.

Dennis Baldwin

unread,
Sep 14, 2007, 5:27:15 PM9/14/07
to iphone...@googlegroups.com
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:


and post your results here.

Thanks,
Dennis

Greg McGuinness

unread,
Sep 14, 2007, 5:52:58 PM9/14/07
to iphone...@googlegroups.com
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:gre...@mac.com


gregmcg

unread,
Sep 14, 2007, 6:14:18 PM9/14/07
to iPhoneWebDev
Here is the iPod Touch

Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML,
like Gecko) Version/3.0 Mobile/3A100a Safari/419.3

Sorry about the triple post, it was a problem I had with edge.

On Sep 14, 5:52 pm, Greg McGuinness <greg...@mac.com> 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:greg...@mac.com


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

rich_wagner

unread,
Sep 15, 2007, 12:11:02 AM9/15/07
to iPhoneWebDev
Excellent. Thanks for the info!

August Trometer

unread,
Sep 15, 2007, 8:00:21 AM9/15/07
to iphone...@googlegroups.com
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

Randy Walker

unread,
Sep 15, 2007, 3:10:00 PM9/15/07
to iphone...@googlegroups.com
Yes, Apple could release a new device tomorrow. This device could
also have Mobile Safari. It could also be yet a different version of
Safari to take advantage of whatever hardware capabilities this "new"
device may or may not have in common with iPod touch or existing
iPhones. I would think checking for just 'mobile' and 'safari' will
cause you many more headaches than checking for those AND the device
name as well. I've seen more than one article stating that Phone &
iPod touch already have dif versions (builds) of safari, even though
they are both called mobile. Who knows if they will ever be exactly
the same?

-=Randy

rich_wagner

unread,
Sep 15, 2007, 4:20:33 PM9/15/07
to iPhoneWebDev
August,

Just to second what Randy said...

Agreed on the general rule of thumb of using object detection and
avoiding user agent detection for Web sites. However, if you are
developing an application specifically for iPhone/iPod, then user
agent detection is a valid way to go. Plus, since an iPhone app is
written for a particular viewport (and might rely on iPhone service
integration), then searching for "iPhone" (and/or "iPod") is preferred
over "Mobile" and "Safari". After all, they could release a iWidePod
that had completely different viewport dimensions.

- Rich

On Sep 15, 3:10 pm, Randy Walker <cleverda...@gmail.com> wrote:
> Yes, Apple could release a new device tomorrow. This device could
> also have Mobile Safari. It could also be yet a different version of
> Safari to take advantage of whatever hardware capabilities this "new"
> device may or may not have in common with iPod touch or existing
> iPhones. I would think checking for just 'mobile' and 'safari' will
> cause you many more headaches than checking for those AND the device
> name as well. I've seen more than one article stating that Phone &
> iPod touch already have dif versions (builds) of safari, even though
> they are both called mobile. Who knows if they will ever be exactly
> the same?
>
> -=Randy
>

> >> mailto:greg...@mac.com


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

August Trometer

unread,
Sep 15, 2007, 5:30:30 PM9/15/07
to iphone...@googlegroups.com
I'm going to have to respectfully disagree here...to a point.

It simply comes down to what you're trying to test for.

If you're looking for an instance of Mobile Safari, regardless of
device, then using my method is the best way. In fact, I think in most
cases, this _should_ be what you're testing for, as Apple is most
likely to keep various versions of Safari in lock-step across devices.
Sure, they might have different build numbers, but they should be,
capability-wise, so similar you won't know the difference.

If you want to know the width of the device, for example, that's a
completely separate test. To test for the width of the viewport (i.e.
window.innerWidth) is much better than to test for the name of a
device. It's highly likely that a new iPhone might have a higher
resolution and, therefore, a different viewport width. The product
name, however, will stay the same. Testing for the string "iPhone"
doesn't tell you anything except the name of the device.

The only reason I can see for testing against device name is to
determine if it can do something in particular (which is problematic
as those capabilities can and will change while the device name will
not). Using the tel: links for phone numbers obviously won't work on
an iPod touch, so testing for "iPod" is a decent solution here. (I
haven't tried it on the iPod touch, but I suspect Apple filters those
links out. If they don't, they should.)

Here's my point: if you're building a web app for the iPhone, you're
really not developing it for "the iPhone." In actuality, you're
developing it for Mobile Safari which Apple is clearly willing to put
on multiple devices.

August

Randy Walker

unread,
Sep 15, 2007, 5:45:23 PM9/15/07
to iphone...@googlegroups.com
"should be" is out of my control.

-=Randy

Reply all
Reply to author
Forward
0 new messages