HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
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.
In HTML5 Guidelines for Web Developers, two pioneering web developers provide a comprehensive guide to HTML5’s powerful new elements and techniques through compact, practical, easy-to-understand examples. You’ll discover just how much you can do with HTML5—from programming audio/video playback to integrating geographical data into pages and applications.
This concise, friendly reference is packed with tips, tricks, and samples for making the most of HTML5 with JavaScript and the DOM. The authors present “pure HTML5” examples that are supported by browsers right now, and they share realistic insights into the challenges of leading-edge HTML5 development. All examples are available for download, with links to web resources for new information and specification updates. Topics covered include
If you’re a web developer or designer with at least basic knowledge of HTML, JavaScript, and CSS, this book is all you need to masterHTML5—and get to the cutting edge of web development.
Preface xi
About the Authors xiii
Chapter 1: Overview of the New Web Standard 1
1.1 How It All Started 1
1.2 Time Travel through Historic Events 7
1.3 In Medias Res 9
1.4 Can I Start Using HTML5 Now? 16
Summary 18
Chapter 2: Structure and Semantics for Documents 19
2.1 Header with “header” and “hgroup” 21
2.2 Content with “article” 22
2.3 Footer with “footer” and “nav” 24
2.4 Sidebar with “aside” and “section” 25
2.5 The Outline Algorithm 27
2.6 Figures with “figure” and “figcaption” 28
2.7 Text-Level Semantics—More New Tags 29
Summary 35
Chapter 3: Intelligent Forms 37
3.1 New Input Types 38
3.2 Useful Attributes for Forms 43
3.3 New Elements 47
3.4 Client-Side Form Validation 57
3.5 Example: A Support Form 64
Summary 68
Chapter 4: Video and Audio 69
4.1 A First Example 70
4.2 The “video” Element and Its Attributes 71
4.3 Video Codecs 73
4.4 Tools for Video Conversion 76
4.5 Which Format for Which Browser? 82
4.6 Interim Solutions for Older Browsers 83
4.7 Video and Scripting—A Simple Video Player 86
4.8 And What About Audio? 99
Summary 105
Chapter 5: Canvas 107
5.1 A First Example 108
5.2 Rectangles 111
5.3 Colors and Shadows 113
5.4 Gradients 114
5.5 Paths 117
5.6 Text 130
5.7 Embedding Images 135
5.8 Pixel Manipulation 141
5.9 Compositing 149
5.10 Patterns 152
5.11 Transformations 156
5.12 Base64 Encoding with “canvas.toDataURL()”163
5.13 “save()” and “restore()”165
5.14 Animations 166
5.15 Anything Still Missing? 173
Summary 177
Chapter 6: SVG and MathML 179
6.1 MathML 180
6.2 SVG 182
Summary 183
Chapter 7: Geolocation 185
7.1 Introduction to Geolocation 186
7.2 A First Experiment: Geolocation in the Browser 190
7.3 Technical Background of Determining Position 193
7.4 Display of Current Position on OpenStreetMap 194
7.5 Location Tracking with Google Maps 196
7.6 Example: Geonotes 197
7.7 Browser Support 202
Summary 203
Chapter 8: Web Storage and Offline Web Applications 205
8.1 Storage 206
8.2 Offline Web Applications 212
8.3 Browser Support 220
8.4 Example: Click to tick! 220
Summary 230
Chapter 9: WebSockets 231
9.1 The WebSocket Server 233
9.2 Example: A Broadcast Server 234
9.3 Example: Battleships 239
Summary 248
Chapter 10: Web Workers 249
10.1 Introduction to Web Workers 249
10.2 Search for Leap Years 251
10.3 Calculate Altitude Profiles with Canvas 253
Summary 259
Chapter 11: Microdata 261
11.1 The Syntax of Microdata 263
11.2 The Microdata DOM API 269
Summary 271
Chapter 12: Finishing Touches: Some Global Attributes 273
12.1 News for the “class” Attribute 274
12.2 Defining Custom Attributes with “data-*” 275
12.3 The “hidden” Attribute 276
12.4 The “classList” Interface 276
12.5 Drag and Drop with the “draggable” Attribute 278
12.5.1 Drag and Drop in Combination with the “FileAPI” 284
12.6 The Attributes “contenteditable” and “spellcheck” 288
Summary 290
Afterword 293
Index 295