Home > Store

Sams Teach Yourself HTML5 Mobile Application Development in 24 Hours

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself HTML5 Mobile Application Development in 24 Hours

eBook (Watermarked)

  • Your Price: $21.75
  • List Price: $27.19
  • About Watermarked eBooks
  • This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.

    The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

    Watermarked eBook FAQ


  • Copyright 2012
  • Dimensions: 7" x 9-1/8"
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-13-285327-2
  • ISBN-13: 978-0-13-285327-9

In just 24 sessions of one hour or less, learn how to build rich, robust mobile apps that run on smartphones, tablets, and other devices and interact with users in powerful new ways. Using this book’s straightforward, step-by-step approach, you’ll master leading-edge practical skills you can use whether you’re developing for the iPad/iPhone or Android. Discover how to quickly build new mobile apps and upgrade older apps, provide cutting-edge media content, leverage advanced features ranging from geolocation to the semantic web, and even simplify complex back-end development. Each lesson builds on what you’ve already learned, giving you a rock-solid foundation for real-world success!

Step-by-step instructions carefully walk you through the most common HTML5 mobile development tasks.

Quizzes and Exercises at the end of each chapter help you test your knowledge.

By the Way notes present interesting information related to the discussion.

Did you Know? tips offer advice or show you easier ways to perform tasks.

Watch Out! cautions alert you to possible problems and give you advice on how to avoid them.

Learn how to…

  • Work with the new HTML5 tags most valuable for mobile development
  • Get started fast with HTML5 features already supported by today’s browsers
  • Detect mobile devices and HTML5 support and upgrade sites to support them
  • Style and build more efficient, usable mobile pages
  • Use jQuery Mobile to quickly create mobile apps
  • Leverage HTML5’s breakthrough drawing and typography features
  • Efficiently integrate media content into your apps
  • Add meaning with HTML5 sectioning and semantic elements
  • Implement drag-and-drop more easily than ever
  • Build offline applications and other apps that use local storage
  • Detect and work with location data via the GeoLocation API
  • Use microformats and microdata to make web pages friendlier to computers
  • Add powerful back-end functionality with WebSockets, Web Workers, and File APIs
  • Improve user navigation with the History API

Sample Content

Table of Contents

Preface     xiv

Part I: Building Web Pages and Applications with the Open Web Standard


Hour 1: Improving Mobile Web Application Development with HTML5     1
Understanding How We Got to HTML5     1
Learning What’s Different with HTML5     3
Defining Web Applications     4
Using the Open Web Standard     4
Using HTML5 with iOS and Android Devices     6
Writing Mobile Websites     7
Summary      11
Q&A     12
Workshop     13

Hour 2: New HTML5 Tags and Attributes with Mobile Development     15
The New HTML5 Tags     15
The New HTML5 Attributes     24
Changes to HTML 4 Tags and Attributes     25
Changes to HTML Syntax in HTML5     27
Mobile Support of HTML5 Tags and Attributes     28
Benefits of HTML5 for Mobile Web Development     29
Summary     30
Q&A     30
Workshop     31

Hour 3: Styling Mobile Pages with CSS3     33
Quick Introduction to CSS     33
What CSS3 Adds to the Party      42
Using CSS3 on Mobile Devices     46
Summary     46
Q&A     46
Workshop     47

Hour 4: Detecting Mobile Devices and HTML5 Support     49
Choosing What HTML5 Elements to Use     50
Android and iOS Support for HTML5     50
Detecting HTML5 Functions     52
Degrading Gracefully     58
Using CSS3 Media Queries to Detect Mobile Browsers     60
Testing Your Applications     63
Summary     64
Q&A     64
Workshop     65

Hour 5: JavaScript and HTML5 Web Applications     67
What is JavaScript?     67
What is jQuery?     72
Using jQuery Mobile     79
Summary     82
Q&A     82
Workshop     83

Hour 6: Building a Mobile Web Application     85
Building a Site that Works on All Devices     85
Deciding on What Type of Application You Want     86
Building the Application in HTML     89
Using CSS to Make the HTML Look Good     91
Adding Mobile Meta Tags for More Effective HTML5 Pages     96
Optimizing Your Site for Mobile     99
Summary     102
Q&A     102
Workshop     103

Hour 7: Upgrading a Site to HTML5     105
Deciding When and How to Upgrade from HTML 4     105
HTML5 Features that Work Right Now     111
The State of HTML5 Browser Support     112
Adding HTML5 Features as Extras on Your Site     113
HTML5 Features that Turn Your Site into a Killer Mobile Application     115
Summary     116
Q&A     116
Workshop     118

Hour 8: Converting Web Apps to Mobile     119
Choosing a Web Editor     120
Testing Your Application     121
Evaluating Your Content     123
Changing the Visual Design for Mobile     124
Checking for HTML5 and CSS3     130
Supporting Multiple Devices     132
Evaluating Finished Apps on Other Devices     133
Getting an Application to Work on Older Browsers     134
Summary     138
Q&A     139
Workshop     139

Part II: Learning the HTML5 Essentials

Hour 9: Adding Meaning with HTML5 Sectioning and Semantic Elements     141
What Are Sectioning Elements?     141
Using the New Sectioning Elements     142
Marking Up HTML Semantically     154
Summary     159
Q&A     159
Workshop     160

Hour 10: Drawing with the HTML5 Canvas Element     163
Using the Canvas Element     163
Drawing Shapes on the <Canvas> Element     165
Writing Fonts and Text on the Canvas     177
Displaying Images     179
How Is Canvas Different from SVG or Flash     182
Summary     183
Q&A     184
Workshop     185

Hour 11: Fonts and Typography in HTML5     187
Defining the Elements of Typography     187
Using Proper Typographical Entities     196
Understanding Web Open Font Format (WOFF)     198
Summary     202
Q&A     202
Workshop     203

Hour 12: Audio and Video in HTML5     205
Why Use HTML5 for Audio and Video vs Flash     205
Choosing Video Formats for the Best Compatibility     207
Choosing Audio Codecs for the Widest Support     208
The New HTML5 Media Elements     210
Useful Attributes to Extend Your Media     212
Creating Fallback Options for Internet Explorer      216
Creating Custom Controls with API Methods     217
Summary     219
Q&A     220
Workshop     220

Hour 13: HTML5 Forms     223
New Usability Features in HTML5 Forms     223
HTML5 Input Types     228
Other New Form Elements     235
Form Validation     237
Summary     241
Q&A     242
Workshop     242

Hour 14: Editing Content and User Interaction with HTML5     245
The New contenteditable Attribute     245
The execCommand Method     247
Adding Spellcheck to Web Pages     251
Hiding Elements     252
Additional UI Components of HTML5     253
Browser Support of UI and Editing Features     255
Summary     257
Q&A     258
Workshop     258

Hour 15: Microformats and Microdata     261
Using Microformats     261
Using Microdata     267
Using RDFa     269
Deciding Which Format to Use     270
Mobile and Microformats     271
Summary      272
Q&A     273
Workshop     274

Hour 16: Working with HTML5 Drag-and-Drop Functionality     275
Implementing Drag and Drop     275
Drag-and-Drop Events     276
Drag-and-Drop Attributes     279
Helpful CSS Extensions     280
Building a Drag-and-Drop Interface     280
Using Drag and Drop on iOS     287
Summary     290
Q&A     290
Workshop     291

Hour 17: HTML5 Links     293
How Links Have Changed in HTML5    293
Link Types and Relationships     299
Using the New Link Types     300
Summary     306
Q&A     306
Workshop     307

Part III: HTML5 for Mobile and Web Applications

Hour 18: Web Application APIs and Datasets     309
Creating Web Applications     309
Datasets and data-* Attributes     318
Summary     320
Q&A     320
Workshop     321

Hour 19: WebSockets, Web Workers, and Files     323
Two-Way Communication with WebSockets     323
Running Scripts in the Background with Web Workers     326
Handling Client-Side Files with the File API     331
Summary     337
Q&A     338
Workshop     339

Hour 20: Offline Web Applications     341
Building Offline Apps and Converting Apps to Work Offline     341
The Cache Manifest     343
Using DOM Events and Properties for Offline Apps     347
Debugging the Application Cache     351
Summary     352
Q&A     352
Workshop     353

Hour 21: Web Storage in HTML5     355
What Is Web Storage?     356
Web SQL and Indexed DB     361
Summary     370
Q&A     371
Workshop     372

Hour 22: Controlling the Browser History with the History API     373
Why Control the Browser History?     373
History API Methods     375
Using the History API     375
Dangers and Annoyances of the History API     383
Summary     384
Q&A     385
Workshop     386

Hour 23: Adding Location Detection with Geolocation     387
What Is Geolocation?     387
Privacy and Geolocation     394
Creating a Mobile Geolocation Application     396
Summary     401
Q&A     401
Workshop     402

Hour 24: Converting HTML5 Apps to Native Apps     405
Comparing the Difference Between Native and HTML5 Apps     405
Converting to Native Apps     408
Creating Application Icons     414
Testing Your Applications     416
Selling Your App in the App Stores     418
Options Other Than Converting to Native Apps     419
Summary     419
Q&A     420
Workshop     421

Part IV: Appendixes

Appendix A: Answers to Quizzes     423
Hour 1, “Improving Mobile Web Application Development with HTML5”     423                                                                  
Hour 2, “New HTML5 Tags and Attributes with Mobile Development”     423
Hour 3, “Styling Mobile Pages with CSS3”     424
Hour 4, “Detecting Mobile Devices and HTML5 Support”     424
Hour 5, “JavaScript and HTML5 Web Applications”     425
Hour 6, “Building a Mobile Web Application”     425
Hour 7, “Upgrading a Site to HTML5”     426
Hour 8, “Converting Web Apps to Mobile”     426
Hour 9, “Adding Meaning with HTML5 Sectioning and Semantic Elements”     427
Hour 10, “Drawing with the HTML5 Canvas Element”     427
Hour 11, “Fonts and Typography in HTML5”     428
Hour 12, “Audio and Video in HTML5”     428
Hour 13, “HTML5 Forms”     429
Hour 14, “Editing Content and User Interaction with HTML5”     429
Hour 15, “Microformats and Microdata”     430
Hour 16, “Working with HTML5 Drag-and-Drop Functionality”     430
Hour 17, “HTML5 Links”     430
Hour 18, “Web Application APIs and Datasets”     431
Hour 19, “WebSockets, Web Workers, and Files”     431
Hour 20, “Offline Web Applications”     432
Hour 21, “Web Storage in HTML5”     432
Hour 22, “Controlling the Browser History with the History API”     433
Hour 23, “Adding Location Detection with Geolocation”     434
Hour 24, “Converting HTML5 Apps to Native Apps”     434

Appendix B: HTML Elements and Attributes     437
HTML5 Elements     437
HTML5 Attributes     442

Appendix C: HTML5 and Mobile Application Resources     447
Books     447
Websites      448
This Book’s Website      448

Index     449


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020