12.07.2015 Views

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

Pro JavaScript for Web Apps pdf - EBook Free Download

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 8 CREATING MOBILE WEB APPSFigure 8-1. Asking the user which version of the web app they requireThis tiny web app gives me a good example with which to introduce jQuery Mobile, which is whatI’ll be using in this chapter. jQuery Mobile is a toolkit optimized <strong>for</strong> mobile devices, and it includeswidgets that are easy to interact with using touch and built-in support <strong>for</strong> handling touch events andgestures.jQuery Mobile is the “official” mobile toolkit from the main jQuery project, and it’s pretty good,although there are some rough edges with some layouts that need tweaking with minor CSS. There areother jQuery-based mobile widget toolkits available—and some of them are very good as well. I havechosen jQuery Mobile because it shares a broadly common approach with jQuery UI and it has somedesign characteristics that are typical of most mobile toolkits and that require special attention whenwriting complex web apps.AVOIDING PSEUDONATIVE MOBILE APPSAnother reason that I use jQuery Mobile is that it doesn’t try to re-create the appearance of a nativesmartphone application, which is an approach that some of the other toolkits adopt. I don’t like thatapproach because it doesn’t quite work. If you give the user something that looks like a native iOS orAndroid app, then you need to make sure it behaves exactly the way a native application should—and, atleast at the moment, that isn’t possible.The worst possible approach is to try to re-create a native app <strong>for</strong> just one plat<strong>for</strong>m. You often see this,and it is usually iOS that web app developers aim <strong>for</strong>. This might not be so bad if the re-creation wasfaithful and all mobile devices ran iOS, but users of Android and other operating systems get somethingthat is totally alien, and iOS users get something that initially appears to be familiar but that turns out to beconfusing and inconsistent.To my mind, it is far better to design a web app that is genuinely obvious and easy to use. The results arebetter, you users will be happier, and you don’t have to contort your web app to fit inside the constraints ofplat<strong>for</strong>m that you can’t properly adhere to anyway.200www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!