If youre just starting to learn JavaScript, CSS, or HTML, then this book is not for you.Consult one of the many books that cover the basics of web application development before you beginreading HTML5 and JavaScript Web Apps . This book assumes you understand how tobuild a web application and have written one before with such libraries as jQuery, Prototype, orplain old DOM APIs.
Also, if you are convinced that server-side generated markup is the way of the future, thenchances are you wont enjoy this book. The topics covered here are mostly directed toward developerswho think offline first and write modern web applications that start out not worrying about the server. The main idea driving this book is to use the web browser as aplatform.
Finally, this book is geared toward the UI. There are a few examples of server-side code,mainly in , but everything else is client-side code with JavaScript andCSS.
What Youll Learn
The world of HTLM5 and mobile is moving at light speed, and we are witnessing arevolution and shift from traditional server-side concepts to heavier client-side ideas.In this environment, building a web app purely from HTML5 and related specifications iscomplicated and challenging, to say the least. These standards can adapt gracefully acrossmobile and desktop browsers, however, and this book will help you shoulder thechallenge.
start with anoverview of the Mobile Web and will help you get a good grasp on which browsers support thestandards that this book talks about and which browsers you should support. Here youll learn on howto grade browsers so that your development team, QA team, and customers will know where you stand onbrowser support.
jumps straight into developing amobile web application with HTML5. This chapter will give you a starting point forbuilding an application with native-like touch events and transitions. Youll also learnto add offline support with the AppCache and dynamically enhance your app based on thetype of network the user is on (3G, WiFi, an so on).
takes a heavier look at how theseframeworks interact with the server.
The remaining chapters go into detail on the five main HTML5 specifications. Youlllearn about the raw implementation of each specification, as well as how its used inreal-world scenarios and use cases. Each chapter ends with a look at the frameworksavailable that support each technology.
For example, takes a broad look at WebSockets and how you can useit on the client and server. This is the only chapter that goes into detail on server-side code.Youll set up a simple WebSocket server and compare frameworks that can be used across mobile anddesktop browsers. The chapter also contains a detailed comparison of Socket.IO, Vert.x, andAtmosphere.
goes into detail on Web Storage. Youll see howtodays top sites like Google, Yahoo!, Twitter, and Amazon are storing data on the client side andinvestigate the best ways to store data along with a breakdown of available frameworks.
Next, looks at Geolocation and discusses real-world uses oftracking users with mobile web browsers and other concepts. This chapter outlines how to use thetechnology and where you might encounter pitfalls in various implementations.
covers the Device Orientation API. Althoughits not the most glorious specification in existence, it has extremely valuable and validuses, as youll learn. This chapter ends with an implementation using orientation for pagenavigation on mobile devices.
Focused on Web Workers, goes into practical uses of threading inthe browser, delving into more detail than simply processing prime numbers in a separate thread. Thechapter provides real-world examples of using Web Workers for processing image data and shows youhow to create your own thread pool.
By the end of the book, you should be comfortable with writing your own HTML5 web app thatworks across any browsers you wish to support. You will have a true understanding of what you canbuild with HTML5, its available frameworks, and todays web browsers.
About the Code
The examples in this book are maintained at http://github.com/html5e.The JavaScript and CSS are self-contained in a simple framework called slidfast.js and slidfast.css. The JavaScript was purposely created to have nodependencies on any other libraries or frameworks. It is built specifically to showcasecore JavaScript and DOM APIs that are provided by the browsers covered in each chapter.Its a learning framework not intended for public consumption, but by all means, learnfrom it and use it wherever you feel necessary.
Conventions Used in This Book
The following typographical conventions are used in thisbook:
ItalicIndicates new terms, URLs, email addresses, filenames, andfile extensions.