Why the iPad’s user agent string presents a problem
Note: This post has been getting a fair amount of traffic. I originally posted this directly after launch, and subsequently it contained outdated information from what is now known from the final release of OS 3.2. I originally had left the original post info for the sake of blogging/ journalistic integrity, however after three revisions because of newer info, I decided to strip the clutter of invalid content. Having said my disclaimer, below is the revised new post, and here is the release version of the iPad UA string as of 4/6/10, pulled directly from my 32GB wifi model:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) version/4.0.4 Mobile/7B367 Safari/531.21.10
more after the break.
The iPad represents itself in line with how the iPhone and iPod Touch differentiate themselves by specifying different device strings, but still contains the word 'mobile' - so Apple is currently explicitly classing this device as a mobile browser. But we now have a new class of devices to case for, segmented somewhere between mobile and non-mobile. While Apple has taken the first real swing at a tablet user agent, it's up in the air whether other tablet browsers will fall in line with this or do their own thing. Consistency is critical for proper detection without necessitating device specific casing.
This is intriguing and presents an interesting new issue for web developers. In their marketing materials, Apple has classified the iPad as designed for a full web experience (barring Flash of course), but they themselves are saying to the developers that this is a mobile device, right in the UA string. Moreover, technically the UA string classification is correct - this is a mobile browser. This isn't the desktop version of Safari. While they are both webkit based, it is inevitable that considerations will want to be made for the glorified Safari mobile browser in the iPad, and using the user agent string to identify that and case for it is problematic unless Apple modifies the UA string. My guess is at some point they will, possibly as soon as 4.0 hits.
It's not so much that this matters for development now as much as that it sets a precedent for future slate browsers. Apple has said here that slate browsers, even if they are larger versions of existing mobile browsers, should identify as a mobile browser, but clearly full sites should, and will be ultimately presented to iPad users in many cases. Even if the UA string wasn't an issue, there's still the question of how to architect a full site for both tablets and desktop viewing (primarily casing for browsers that do and don't have Flash). Proper implementation of progressive enhancement techniques is a great solution (see my related post on this topic here).
Maybe this whole UA string mess will all be a moot point when we see the 4.0 beta. As with all things Apple launch related, time will tell. One thing you can count on is that if the iPad succeeds, the precedent will be set. We'll see who follows.




January 31st, 2010 - 17:57
This is not the correct user agent string for the iPad, more likely the current simulator is using the user agent from the host computer (after all, we know it’s not running OSX 10.5.8, but I bet “yassiyhara” is.
The iPad string is (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10
Which presents another set of problems for an entirely different reason
February 1st, 2010 - 11:05
Andrew:
Thanks for posting the correction – this makes much more sense, and follows in line with how the iPhone and iPod Touch represent themselves. that’s what i get for trusting a random Twitter account
I’ll update the post later to reflect this.
-Jeff
April 5th, 2010 - 23:54
You guys may not have had the benefit of the latest version of the Simulator, or the actual device. The iPad user agent does not say ‘iPhone’ in it at all. Here it is:
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B360
April 6th, 2010 - 09:36
Run this line in command prompt, this will change the chrome browser user agent to ipad
chrome -user-agent=”Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10″
April 6th, 2010 - 09:55
@Andrew thanks for the note – I have updated the post to reflect the release version UA string. Interestingly, my iPad UA string differs from yours slightly (32GB WiFi):
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) version/4.0.4 Mobile/7B367 Safari/531.21.10
How did you verify your UA string and what model are you on? I’m curious where the minor discrepancy arose.
April 6th, 2010 - 10:01
@manny – Good tip. Readers, also note that the Safari UA string can be spoofed using the developer menu (enable in prefs on mac or pc versions). entries can be added for iPad until Safari is updated to include them by modifying the UserAgemts.plist file for Safari. Additionally, User Agent Switcher for Firefox can spoof any UA string as well.
Note that in both cases this does not emulate legitimate rendering of pages on the iPad and will render the page exactly the same as it would without spoofing (case in point, Flash will still work). Rather, it lets you see how websites treat the use case of the specified UA string. You’ll find that many sites will still show mobile variants for the iPad UA string as of now (mostly due to Apple including ‘mobile’ within the UA string). We’ll see if future iterations of the iPad UA string present the device differently.
May 23rd, 2010 - 04:59
No, the problem is websites detecting user agent strings at all.
You should be building just 1 website for all devices, detecting things like viewport size with CSS media queries when necessary. If you want to show an interface that’s optimized for 480×320, show that to all devices with that size viewport, not to all devices that have “mobile” in their user agent string. That is based on the assumption that of them have tiny handheld screens, which is not true. The iPad is merely exposing the problem with your assumption.
May 25th, 2010 - 19:04
Is it possible to update the user agent string on an iPad to emulate another browser such as IE?