Chapter 13. Geolocation, Web Workers, and History Management

By now, you know all about the key themes of HTML5. You’ve used it to write more meaningful and better-structured markup. You’ve seen its rich graphical features, like video and dynamic drawing. And you’ve used it to create self-sufficient, JavaScript-powered pages that can work even without a web connection.

In this chapter, you’ll tackle three features that have escaped your attention so far. As with much of what you’ve already learned, these features extend the capabilities of what a web page can do—once you add a sprinkling of JavaScript code. Here’s what awaits:

  • Geolocation. Although it’s often discussed as part of HTML5, geolocation is actually a separate standard that’s never been in the hands of the WHATWG (HTML5: Back from the Dead). Using geolocation, you can grab hold of a single piece of information: the geographic coordinates that pinpoint a web visitor’s current location.

  • Web workers. As web developers make smarter pages that run more JavaScript, it becomes more important to run certain tasks in the background, quietly, unobtrusively, and over long periods of time. You could use timers and other tricks. But the web workers feature provides a far more convenient solution for performing background work.

  • Session history. In the old days of the Web, a page did one thing only: display stuff. As a result, people spent plenty of time clicking links to get from one document to another. But today, a JavaScript-fueled ...

Get HTML5: The Missing Manual, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.