views:

67

answers:

0

I'm trying to push packets of data from my HTTP server to a browser, using a Comet "forever iframe" and feeding it script tags from the server using the Transfer-Encoding: chunked header. What I'm finding is that my script tags aren't being interpreted right away, and I have to send a number of chunks before the browser starts to respond to them. In the case of IE8 this seems to require something like 256 bytes worth of data (I haven't checked precisely), and in Firefox 3.5.7 it seems to be something over a kilobyte. I haven't yet managed to get Chrome to respond to the script tags at all before the connection closes. However in all cases if I end the chunked data (with the '0' chunk), any buffered chunks are interpreted. I've found some reference to this kind of behaviour on Safari, but have not found any such information for other browsers.

What I'd like to know is how can I reliably execute these script tags as they are sent, without what seems to be some kind of buffering mechanism delaying their execution?