Chapter 10

Going Mobile

In recent years, users have been moving away from desktop computers and relying more and more on mobile devices to browse the web. The mobile growth rate has been staggering, especially outside of North America. In many developing countries, users are skipping over the desktop computer and browsing the web for the first time on a mobile device.

For instance, Asia saw a 192 percent growth rate in mobile traffic share from 2010 to 2012, according to Pingdom (http://royal.pingdom.com/2012/05/08/mobile-web-traffic-asia-tripled). And it's not just an Asian phenomenon: The worldwide increase in that period is over 162 percent.

Although desktop browsing still outpaces browsing on mobile devices, that is projected to change as early as 2014. That's an enticing opportunity, and many companies are positioning themselves to reap the rewards of mobile traffic. Mobile-first has become a common mantra among many developers, who are now gearing their apps toward mobile devices, with desktop support as an afterthought. That's a remarkable shift from a couple of years ago when mobile apps were tacked onto the primary offering: desktop web apps.

In this chapter, you find out how to position your web app in the mobile space. You first learn how to detect mobile devices and create responsive layouts that adjust for different screen sizes and device orientations. Then you learn about a couple of scripts you can employ to handle the mobile viewport and to serve responsive content, ...

Get JavaScript Programming: Pushing the Limits now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.