Home > Store

HTML5 Unleashed

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

HTML5 Unleashed

eBook

  • Your Price: $34.39
  • List Price: $42.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

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

Description

  • Copyright 2014
  • Dimensions: 7" x 9-1/8"
  • Edition: 1st
  • eBook
  • ISBN-10: 0-13-315134-4
  • ISBN-13: 978-0-13-315134-3

HTML5 Unleashed is the authoritative guide that covers the key web components driving the future of the Web. Harness the power of HTML5 to create web apps and solutions that deliver state-of-the-art media content and interactivity with new Audio, Video, and Canvas elements.

HTML5 technologies are essential knowledge for today's web developers and designers. New APIs such as Local Storage, Geolocation, Web Workers, and more expand the Web as a platform, allowing for desktop-like applications that work uniformly across platforms.

Comprehensive and up-to-date, HTML5 Unleashed is organized as an accessible guide of tutorials and practical references. Because HTML5 covers a far-reaching set of standards, each chapter in HTML5 Unleashed is written to stand on its own. Whether you choose to skip around or read it cover to cover, full-color syntax and figures in HTML5 Unleashed ensure that you do not need to be next to a computer to learn the most important concepts of the modern Web.

DETAILED INFORMATION ON HOW TO…
  • Use new HTML5 features and syntax to create common web page components in a standardized way, with less code
  • Ensure graceful backward compatibility with "polyfilling" libraries, so users of older browsers are not left behind
  • Harness the power of semantic HTML5 tags and Microdata to improve your site accessibility and search engine results
  • Create consistent, rich user experiences across desktop and mobile platforms with the new Audio and Video elements
  • Create HTML5 Canvas web applications, with chapters dedicated to Canvas interactivity and Canvas performance
  • Utilize the new functionality of Geolocation to display locality-aware content to users and harness the power of GPS
  • Use the new Local Storage options to build pages that work offline and robust apps that can store heavyweight data client-side
  • Allow more sophisticated page communication with Cross-Document Messaging and enable multithreaded JavaScript with Web Workers
  • Communicate with servers in real-time with WebSockets and take advantage of the new Ajax possibilities with XMLHttpRequest Level 2

Sample Content

Table of Contents

Introduction    1

Who Should Read This Book?     2

HTML5 and Related Technologies    2

Software Requirements    3

Code Examples    3

How This Book Is Organized    3

Part I: Background    4

Part II: New HTML Elements    4

Part III: Canvas    4

Part IV: HTML5’s JavaScript APIs    4

Links and Real-World Examples    5

Chapter 1: Why HTML5?     7

How Did We End Up Here?     7

The Web Takes Off    9

The Rise of the Browser Plug-In    9

Web 2.0    10

HTML5    11

What Exactly Is HTML5?     11

The Importance of HTML5    12

Are Plug-ins Dead?     14

Summary    14

Chapter 2: Important Concepts for HTML5    15

The Goals of HTML5    15

Improving the Native Web    15

More Done with Less Code    16

The Semantic Web    16

Requisites for HTML5 Development    16

Modern Browser Developer Tools    16

HTML5 Fallbacks: Shims, Shivs, and Polyfills    17

Feature Support and Detection    18

Summary    19

Chapter 3: Getting Started with HTML5: Semantic Tags, Forms, and Drag and Drop 21

Ensuring Backward Compatibility with the New HTML Tags    21

The HTML5 Shim    22

HTML5 Boilerplate    23

Starting from the Top    23

The Doctype    23

Meta Character Encoding    24

HTML5 Syntax and Validation    24

How You Should Write Your HTML    27

Housekeeping    29

HTML5 Semantic Elements and Other Presentational Tags    31

HTML5 Semantic Tags    31

Document Outlines in HTML5    33

Minor Semantic and Presentational HTML5 Tags    35

Visual HTML5 Tags: <meter> and <progress>    37

HTML5 Forms    40

Form Input Types    40

New Form Input Attributes and Elements    47

Drag and Drop in HTML5    53

The Basics    53

Drag Data and Effects    55

Drag Events    58

Summary    67

Chapter 4: Rich Media Tags: Video and Audio    69

The Video Element    71

Video Formats and Support    71

Using the Video Element    75

The Audio Element    77

Audio Formats and Support    77

Using the Audio Element    79

Encoding Your Media    80

Conversion Tools    81

Supporting Older Browsers    81

Video and Audio Attributes    82

Video-Only Attributes    82

Attributes Shared Between Audio and Video    85

JavaScript API    90

The readyState and Starting at a Specified Time    92

The playbackRate and Time Control    93

Loading Videos Sequentially    94

Custom Controls    95

Advantages and Disadvantages of the HTML5 Media Tags Versus Flash    95

Ease of Use and Extensibility    95

Platform Support    96

Feature Support    96

Media Protection    97

Future Developments    97

WebRTC    97

WebVTT and the <track> Tag    98

The Full-Screen API    100

The Web Audio API    100

The Embed Element    101

Summary    101

Chapter 5: 2D Canvas    103

Browser Support    104

Internet Explorer    105

Testing for Support    105

What Canvas Can and Cannot Do    106

A Comparison with SVG    107

Where Canvas Shines    109

When to Not Use Canvas    109

Don’t Use Canvas for General UI    111

Getting Started with Canvas    111

An HTML Page with a Canvas    113

Canvas Attributes    115

toDataURL    116

Context Methods and State    117

A Quick Look at the Properties and State Available    117

Understanding Drawing, Starting with Rectangles    118

fillStyle and strokeStyle    119

Paths    120

Understanding the Canvas Coordinate System    122

Line Styles    125

Curves    127

Ellipses    133

isPointInPath    135

Path Filling--The Winding Number Rule    135

Summary of Context State So Far    138

Saving and Restoring    140

Transformation Matrix    141

translate    141

scale    143

Saving and Restoring Affect How Drawing Functions Act on a Transformed Canvas    143

rotate    146

transform and setTransform    150

Keeping Track of Transformations    152

In-Memory Canvases    154

Using Images and Other Canvases    160

Double Buffering    161

Image Data and Pixel Manipulation    162

getImageData    162

createImageData    164

putImageData    164

Image Security on the Canvas    171

CORS    172

But I Want to Test My Image Data Code Locally!     172

Gradients and Patterns    173

Linear Gradients    173

Radial Gradients    175

Gradient Performance and Reuse    177

Patterns    179

Shadows    182

Compositing    184

Compositing Examples    186

Clipping    189

Clearing Nonrectangular Areas    190

Using Text    192

First the Bad Parts    192

Drawing Text    194

Fonts    195

textBaseline    197

textAlign    197

Measuring Text     198

Performance    199

Canvas Context Recap    200

Styling    200

Shadows    200

State    200

Rectangles    200

Paths    201

Image Drawing    202

Transformation    202

Compositing    202

Text    202

Image Data    203

Summary    203

Chapter 6: Making Canvas Interactive and Stateful    205

Canvas Coordinates--Mouse and Touch    205

getBoundingClientRect    206

Computing Element Offset    207

Canvas Animation    210

Letting the Browser Take Control with requestAnimationFrame    210

Animation and Timing    212

Canvas Interactivity Example: Making and Moving Shapes    215

Getting Started    216

The Shapes We Draw    217

Keeping Track of Canvas State.     218

Mouse and Touch Events    219

Getting Input Coordinates    222

Drawing    223

Complete Canvas Interactivity Example    225

Summary    231

Chapter 7: Canvas Performance, Tips, and Peculiarities    233

Canvas Peculiarities and Tips    234

CSS Width and Height    234

Paths or Images Look Blurry    234

The Methods save and restore    236

Clipping Regions Can Only Get Smaller and Cannot Be Reset    237

Security Exceptions, Cross-domain Images, and Image Data    238

Transformations Affect Drawing in Addition to Paths    238

A Performance Primer    239

Tools of the Trade    240

Before We Get to Canvas    245

The DOM and Canvas    248

Caching Context Properties    248

Stop Using save and restore    250

Caching with Images and In-Memory Canvases    251

Images    252

Text     252

Shadows    253

Gradients    254

Paths    255

Multiple Canvases    256

Keeping Track of Objects    257

Hit Testing    257

Size Matters    260

Summary    261

Chapter 8: The Future of Canvas and 3D Canvas    263

The Future of 2D Canvas    263

New in the Specification    264

Hints from the Browsers    270

3D (WebGL) Canvas    271

WebGL Libraries    272

Summary    275

Chapter 9: Geolocation API    277

Understanding Latitude and Longitude    278

Types of Geolocation Data    280

The Old Ways    280

The HTML5 Way--New Methods for Geolocation    281

HTML5 Geolocation API    282

Geolocation Support    283

Using Geolocation    283

The API    283

Geolocation in Action    288

Where Am I?     288

A Trailblazing App    293

Summary    299

Chapter 10: HTML5 Storage Options    301

Older Storage Methods    301

Browser Cookies    301

Flash Cookies    302

userData    302

Along the Way    302

Web Storage--sessionStorage and localStorage    303

sessionStorage    303

localStorage    304

API    304

WebSQL Database    307

IndexedDB    308

Getting Started with IndexedDB    308

Looking Further    322

FileSystem API for Local Read/Write Access    323

FileSystem API Example    324

Offline Pages and the Application Cache    326

Using the Application Cache    327

Important Notes About the Application Cache    330

Summary    331

Chapter 11: Messaging and Web Workers    333

The Web Messaging API and Cross-Document Messaging    333

Sending and Receiving Messages    334

Channel Messaging    336

Security with Web Messages    338

Web Workers    339

Getting Started with Web Workers    340

A Simple Example    342

Shared Web Workers    345

Web Worker Considerations    349

Summary    351

Chapter 12: Network Communication: WebSockets and XMLHttpRequest Level 2    353

Real-Time Communication with WebSockets    354

Before WebSockets    354

Getting Started with WebSockets    355

A Complete WebSockets Example    358

Server-Side WebSockets    359

New AJAX Capabilities with XMLHttpRequest Level 2    359

New Features in XHR2    360

Summary    364

Chapter 13: Microdata, Other Small Things, and Beyond HTML5    365

Microdata    365

Getting Started with Microdata    367

A Microdata Recipe Example    371

New Browser Features Not Covered in This Text    373

Honorable Mention: The File API    373

Other New Browser Features    375

The Future    378

The Future of Web Development    379

Summary    380

Index    381

Updates

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.

Overview


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.

Surveys

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.

Newsletters

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.

Security


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

Children


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

Marketing


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.

Choice/Opt-out


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.

Links


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