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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.