Apress Learn HTML5 and JavaScript for iOS (2012).pdf

(16609 KB) Pobierz
902099842.013.png
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
902099842.014.png 902099842.015.png 902099842.016.png 902099842.001.png 902099842.002.png 902099842.003.png 902099842.004.png 902099842.005.png
Contents at a Glance
Contents.................................................................................................................. vii
About the Author ................................................................................................. xxix
About the Technical Reviewer ............................................................................. xxix
Preface ................................................................................................................. xxx
Chapter 1: Getting Started ................................................................................... 1
Chapter 2: HTML5 in Short ................................................................................. 21
Chapter 3: CSS3 and iOS Styling ........................................................................ 41
Chapter 4: JavaScript and APIs ......................................................................... 65
Chapter 5: Mobile Frameworks.......................................................................... 85
Chapter 6: Usability, Navigation, and Touch .................................................... 103
Chapter 7: GPS and Google Maps..................................................................... 121
Chapter 8: Animation and Effects .................................................................... 141
Chapter 9: Canvas ............................................................................................ 157
Chapter 10: Audio and Video............................................................................ 175
Chapter 11: Integrating with Native Services .................................................. 185
Chapter 12: Offline Apps and Storage .............................................................. 195
Chapter 13: Mobile Testing .............................................................................. 203
Chapter 14: Advanced Topics .......................................................................... 219
Chapter 15: Going Native with PhoneGap ........................................................ 229
v
902099842.006.png 902099842.007.png 902099842.008.png 902099842.009.png
 
Appendix: Companion Site References ............................................................ 249
Index..................................................................................................................... 263
vi
902099842.010.png
C H A P T E R 1
■ ■ ■
Getting Started
Congratulations! You are building your first web application for your iOS device (iPhone, iPad, or iPod
Touch) using HTML5 and JavaScript.
You might think that you can pick up one of your HTML or JavaScript books from years past and
then just scale it down to the size of your target device and you’ll be good to go. You’d be wrong. A lot
has changed.
In this chapter we lay the groundwork for building a mobile web app. Here we cover things like
getting familiar with your browser, setting up your mobile project, architecting the site, and creating a
site map as well as selecting the tools you’ll use to build it.
All you need is an idea, and I’ll help you take care of the rest.
You purchased this book to get started building a mobile web app. I won’t beat around the bush and
tell you about the history of the Internet or the history of browsers. Instead, let’s just jump in.
Your Browser (Mobile Safari)
The browser we’ll focus on is Mobile Safari—a WebKit-based browser engine that does an excellent job
of parsing HTML5 and interpreting JavaScript.
Note Browsers use different rendering engines. Safari and Google Chrome use WebKit, Opera uses Presto,
Firefox uses Gecko, and Internet Explorer uses Trident. In later chapters we’ll need to use specific features of
WebKit to achieve a more native-looking mobile web application.
Mobile Safari acts and renders in many ways similar to regular Safari, but it has a smaller screen, of
course, and responds to gestures and touches as opposed to clicks. It also has noticeable performance
differences and does not support Adobe Flash.
One of mobile Safari’s most important screens is its Settings screen. You can get to it by clicking on
Settings, and then Safari on the iPhone or iPad home screen. You’ll see a screen like the one shown in
Figure 1-1.
1
902099842.011.png 902099842.012.png
 
Zgłoś jeśli naruszono regulamin