SHARE
Facebook X Pinterest WhatsApp

Tips for iPad Web Development

Apr 6, 2010

With Apple’s release of its iPad this week, many web developers have been preparing their websites to be compatible with the tablet device. With its lack of support for Flash, developers are being encouraged to use HTML5, and this article tells you some tips to get you started!


While Apple is touting HTML5 for their iPad, what they really seem to mean is the use of the <video> tag rather than Flash video, and their own CSS animations and transitions rather than traditional Flash applications. Aside from that, here are some tips to help your site work with the iPad.


  • User-agent string – you can detect the iPad Safari user-agent, which shows up as such:
    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
    

  • JavaScript iPad detection – with JavaScript, you can use the navigator.platform function to check for iPad as the user-agent, like so:
    function isIPad(){
        return navigator.platform == “iPad”;
    }
    

  • Screen dimensions and orientation – an iPad’s screen resolution is 1024×768, and can also be detected using JavaScript’s screen.width and screen.height functions.
  • mobile Safari – the iPad uses pretty much the same Safari as the iPhone and iPod Touch–the touch and gesture events work on the iPad the same as they do on other Apple devices.

Nicholas C. Zakas’ book, Professional JavaScript for Web Developers, 2nd Edition, covers the JavaScript functionality used in these examples and more for the advanced web developer.

Recommended for you...

Web 3.0 and the Future Of Web Development
Rob Gravelle
Jun 23, 2022
CodeGuru and VBForums Developer Forums and Community
James Payne
Apr 7, 2022
Understanding CSS Template Layout
Vipul Patel
Mar 29, 2022
Criminals Pay More for Code Signing Certificates Than for Guns or Passports
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.