开发者

JavaScript multithreading in IE6?

Is JavaScript multithreading possible in IE6?

Are there a开发者_开发问答ny third party libraries for this?


JavaScript does not support native multithreading in current web browsers. Even if it did, I bet IE 6 wouldn't have supported it :)

Running your scripts in multiple iframes could be one workaround, as Jason Kester suggested in another answer.

In addition, for modern browsers you might be interested in checking out Web Workers, but this is definitely something out of the IE 6's league:

  • Stack Overflow: JavaScript and Threads
  • Dive into HTML 5: Web Workers
  • Firefox 3.5: Web Workers in action
  • John Resig: Computing with JavaScript Web Workers


Run your tasks in IFrames

Assuming you're talking about multitasking on the client side, you can open n frames on your page, each pointed to a page on your domain.

There are lots of ways to architect it from there. Probably the easiest would be to have a single .js include that you run from each frame. It phones home to parent.readyToGo() or whatever, and gets some work assigned. The worker methods can call something like parent.taskFinished() to report when they're done.

Most importantly, don't listen to anybody telling you not to run your mission critical multithreaded javascript application on IE6. I'm sure you have good reasons:)


There is no way - definitely not in IE6. You can fake it by using lots of window.setTimeout()s.

See Why doesn't JavaScript support multithreading?


Well, HTML5 is coming up with Web-Workers. But i highly doubt there is a library which creates a wrapper for using it in IE6.

Does my browser support web workers?


Google Gears is a plugin that works with IE6 and includes something called WorkerPools. Google Gears does not seem like it is being very actively developed anymore, because it has tried to move most of the ideas of Gears into HTML5. WorkerPools are basically background processes that do not share state and only communicate through messages. In HTML5 this has turned into WebWorkers. You can find more info here: http://code.google.com/apis/gears/api_workerpool.html


If you merely want to write synchronous code and thus avoid having to deal with writing event handlers all over the place, you can try: Strands

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜