views:

216

answers:

6

Is JavaScript multithreading possible in IE6?

Are there any third party libraries for this?

+10  A: 

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:

Daniel Vassallo
+1 (And it's a good thing it doesn't, I think ;-)
ChristopheD
What about web workers? Not in IE6, obviously, but still...
luiscubal
@luiscubal Yes good point. They are in fact mentioned in the post I linked to originally. Modified my answer to include some further info.
Daniel Vassallo
Why would you want IE6 to support even more error-ridden features?
George Edison
Edison : To force the user to ultimately give up IE6 and use an actual browser
Amitabh
+2  A: 

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

See http://stackoverflow.com/questions/39879/why-doesnt-javascript-support-multithreading

andras
+1  A: 

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

Russell Leggett
+2  A: 

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?

N 1.1
i am amazed no one mentioned web workers!
N 1.1
+1 for mentioning them :)
Daniel Vassallo
+1  A: 

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

Dark Falcon
+3  A: 

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:)

Jason Kester