JavaScript and Threads

See for the most up-to-date support info.

The following was the state of support circa 2009.

The words you want to google for are JavaScript Worker Threads

Apart from from Gears there’s nothing available right now, but there’s plenty of talk about how to implement this so I guess watch this question as the answer will no doubt change in future.

Here’s the relevant documentation for Gears: WorkerPool API

WHATWG has a Draft Recommendation for worker threads: Web Workers

And there’s also Mozilla‚Äôs DOM Worker Threads

Update: June 2009, current state of browser support for JavaScript threads

Firefox 3.5 has web workers. Some demos of web workers, if you want to see them in action:

  • Simulated Annealing (“Try it” link)
  • Space Invaders (link at end of post)
  • MoonBat JavaScript Benchmark (first link)

The Gears plugin can also be installed in Firefox.

Safari 4, and the WebKit nightlies have worker threads:

  • JavaScript Ray Tracer

Chrome has Gears baked in, so it can do threads, although it requires a confirmation prompt from the user (and it uses a different API to web workers, although it will work in any browser with the Gears plugin installed):

  • Google Gears WorkerPool Demo (not a good example as it runs too fast to test in Chrome and Firefox, although IE runs it slow enough to see it blocking interaction)

IE8 and IE9 can only do threads with the Gears plugin installed

Leave a Comment