Preparing Your Site for the iPad
by Ben Gross
The Apple iPad does an excellent job of displaying most web sites. However, there are a few obstacles you may want to avoid. There are also a few customizations that will make your site look even better on the iPad. I will summarize the most important issues you should start to plan for and the differences between the iPad browser, the iPhone browser, and desktop browsers. As an added benefit, most improvements made for the iPad will also benefit users with an iPhone or an iPod Touch. There is list of resources to find more information and a list of tools to help you test your site at the end of the article.
Differences in Mobile Safari on the iPad
The primary differences you should account for first are:
- No support for plugins such as Adobe’s Flash or Sun’s Java for ads, navigation, and multimedia
- The fixed viewable screen size (viewport) may affect your layout
- The touch screen is the primary means of interaction and offers different modes of user control
Unlike most desktop browsers, the iPad does not support plugins such as Flash or Java. Any navigation elements, embedded audio and video, or banner ads written in Flash or Java will not appear. Based on public statements, Apple is unlikely to support either language in the future. This means you will need to provide alternative or fallback navigation elements and multimedia embedding options. Apple’s official recommendation is to avoid plugins entirely and use HTML5 elements across your site. Navigation elements may be implemented with standard AJAX techniques. If your revenue depends on banner advertising delivered via Flash or Java, you will need to need to make some changes. If your ad server supports mobile devices, you can turn this on for iPad users. An alternative is to treat mobile users the same as email campaign advertisements. Today at the iPhone OS 4.0 press event, apple announced its own mobile ad platform and ad network called iAd, implemented entirely in HTML5. The mobiThinking Guide to Mobile Advertising Networks in the references surveys most of the available mobile ad network options.
The standards and implementations of HTML5 audio and video tags are still evolving and making your content available in all browsers is still complicated. Supporting HTML5 H.264 encoded video with a fallback to Flash for browsers that do not support it is likely your most straightforward solution. In the references, I have linked to some of John Gruber’s articles on H.264 and Flash that explain the problem in more detail. Video for Everybody from Camen Design and the upcoming SublimeVideo from Jilion are two options for hosting HTML5 friendly video on your site.
The iPad has a 9.7-inch touch-sensitive screen, a fast processor, and fast network connectivity. It provides a web browser experience that is much closer to the desktop experience than a smartphone. This means you should avoid sending iPad users to versions of your site optimized for mobile phones if you are sniffing for iPhone or mobile user agents. If you look at the user-agent strings for the iPad and the iPhone, you will notice that the iPad user-agent lists “like Mac OS X” rather than “iPhone OS.” Both browsers include the “Mobile” in the user-agent string. Most browsers have mechanisms to change the user agent string. I’ve listed some of these in the references.
The current version of iPhone OS (version 3.1.3) uses the following user agent string (line artificially wrapped):
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16
While the iPad with iPhone OS 3.2 uses the following user agent string (line artificially wrapped):
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
The iPad viewport is set to 980 pixels wide, in portrait mode the iPad is 768 pixels wide, but the content will scale to 980 pixels. If you have content that wider than the viewport that uses fixed CSS positioning, that content may end up off screen and your users will not see it since they can not resize the window in Mobile Safari.
Users control the iPad with a multi-touch interface and a touch screen keyboard. The “Apple iPhone Human Interface Guidelines: Introduction” is a great document for starting to think about multi-touch user interaction as the metaphors and modes of physical interaction differ. For example, a flick action rather than a mouse controls scrolling and a pinching action controls how a page scales up and down.
There are other issues, some of which Apple may resolve in a future update. In John Gruber’s review of the iPad, he points out that often only a single page is held in memory at one time, subsequent pages often take all the memory available for web pages. This means that if you could loose form data on a page that you have not submitted if you open another page. The memory problem could also appear on AJAX heavy pages.
iPhone OS User Base
Apple announced the iPad at then end of January and released specifications, documentation, and a software development kit (SDK) for those paid members of the iPhone developer program under an non-disclosure agreement. The WiFi only model of iPad began shipping this week and Apple released the SDK to everyone registered in the Apple Developer Program. Apple announced that it sold more than 300,000 iPads on the first day and more than 450,000 as of April 8th. The iPhone OS platform user base is significant. Steve Jobs announced that there were 75 Million iPhones and iPad Touch devices running iPhone OS at the iPad launch in January. The Apple’s 2010 Q1 filing said that it had sold more than 42 million iPhones total. Today at the iPhone OS 4.0 launch Jobs announced that there were 85 million iPhone OS devices.
Mobile Safari on the iPad uses the open source WebKit rendering engine as do iPhone, and iPod Touch devices. Testing your site with the WebKit rendering engine is now essential. Desktop versions of the Safari browser, Google’s Chrome browser, all iPad, iPhone, and iPod Touch devices, Android devices, Palm webOS devices, Symbian Series 60 (S60) devices all use WebKit. RIM has stated that future BlackBerry devices will use WebKit. This means that every major smartphone browser aside from Windows Mobile will be WebKit-based in 2010.
Testing Your Site on the iPad
Testing your site directly on an iPad is the only way to guarantee that your experience will match your visitors with iPads. There are numerous reports by developers of minor differences between the iPad and the iPad in a simulator.
However, next to owning an iPad, the iPhone simulator comes closest to rendering your site as an iPad would. The iPhone simulator that ships with the iPhone SDK 3.2 has an iPad mode under the device option. Anyone can register as an Apple Developer for free and then download the SDK. The iPhone SDK includes the XCode development environment and is nearly a 2.5 gig download, it also only works on Mac OS X 10.6.2 (Snow Leopard) or higher.
The paid iPhone Developer Program is $99 a year. The subscription allows developers to submit native iPhone and iPad applications to Apple’s App Store. Apple also allows paid developers early access to upcoming versions of its SDK such as the iPhone OS 4.0 SDK announced today.
iPad Peek by Pavol Rusnak is a web service that allows you to see what your web site will look like on an iPad. It is free and the source code is available under an open source license. Three things will make your experience with iPad Peek closer to than of an actual iPad.
- Use a browser with a WebKit-based rendering engine, preferably Safari, since it is the most similar to the iPad browser. Chrome will works too.
- Disable all plugins in your browser. Otherwise your browser will still load the plugins even though an iPad would not.
- Change your user agent string in your browser to match the iPad one listed earlier.
Apple’s Official Developer Documentation
- Apple Technical Note TN2262: Preparing Your Web Content for iPad
- Apple Safari Reference Library
- iPhone Human Interface Guidelines: Introduction
- Safari HTML5 Audio and Video Guide: Introduction
WebKit developer site
- mobiThinking Guide to Mobile Advertising Networks (2010) is a comprehensive look at mobile advertising networks.
- How iPad Affects the Way we Design Websites? from inspired magazine says to use fluid layouts, adaptive CSS, and forget about your hover effects.
- How to fit your website for the Apple iPad from x7 Labs is an excellent description of the issues related to the viewport width.
- iPad Orientation CSS from Cloud Four describes how you can use different stylesheets depending on orientation
- Dive Into HTML5 book by Mark Pilgrim is great resource for HTML5 information.
- The chapter on Video on the Web in Dive Into HTML does a good job of explaining the intricacies of HTML5 video.
- Apple has a showcase of high-profile sites that provide HTML5 video that works with the iPad at iPad-ready websites
- Getting Your WordPress Themes Ready for Apple iPad from WPLover has a nice description of the issues to pay attention to if you develop WordPress themes.
- John Gruber’s review of the iPad
The easiest way to change your user agent in Safari is to use the option in the developer menu. The easiest way to change the user agent in Chrome and Firefox (uses the Gecko rendering engine, not WebKit) is to use an extension.
- Apple describes changing the user agent string in Safari using the Developer Menu in Safari User Guide for Web Developers: Prototyping Your Website
- Firefox User Agent Switcher extension by Chris Pederick
- Chrome User-Agent Switcher extension
- UserAgentString.com is an easy way to check your current user-agent string.
- iPad Peek by Pavol Rusnak for simulator-free testing
- SublimeVideo by Jilion is a gorgeous HTML5 video player with a Flash fallback. Unfortunately, the product is not yet shipping, but a demo is available online.
John Gruber at Daring Fireball has written a series of posts about Flash, HTML5, and H.264 video. They are really worth reading for background on the technical and political issues related to HTML5.
- Daring Fireball: Who Can Do Something About Those Blue Boxes?
- Daring Fireball: Why the HTML5 ‘Video’ Element Is Effectively Unusable, Even in Browsers Which Support It
- Daring Fireball: GIF, H.264, and Patents
- Daring Fireball: On Submarine Patents vis-à-vis H.264 and Ogg Theora
* This article originally appeared as Preparing Your Site for the iPad in my Messaging News “On Message Column.”