With Web Workers, you can split computationally expensive tasks into separate JavaScript threads and communicate to them independently from the main JavaScript program actually running in a web page.

The workers themselves are clones of the JavaScript runtime environment, so nearly all built-in methods and functions are available, but there are some restrictions on what they can do. For example, a worker cannot access the normal browser window directly, including the window and document objects, nor the DOM itself, so its perspective on the browser’s HTML rendering process is nil. Web Workers do have access to the navigator and location objects, though, so they can discover what the browser is running and its current URL; ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with O’Reilly online learning.

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