Chapter 12. More Cool JavaScript Tricks
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—with a scrap 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). However, like many of HTML5’s features, geolocation lets you power up pages with a bit of JavaScript. 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 ...
Get HTML5: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.