First, I don't see anything wrong with the code. I think the servercode might have a bug (or maybe a connection problem which stops the server from receiving the whole message). Have you tried printing out what the server gets each time the script calls it?
Second, don't detect the browser used, detect which objects are available. (Some browsers can be set to appear as others, even if they don't support the same things.)
One good way to do this is to try to create the ActiveX objects in the order you'd like them to be prioritized.
Here's one way to do it.