captncraig
captncraig

Reputation: 23108

Can I render text/plain content as it arrives?

I have an server that delivers data that it processes over about 15 seconds. The headers are as follows:

Content-Type:text/plain; charset=utf-8
Transfer-Encoding:chunked

With telnet I can confirm that data is sent continuously over 15 seconds. In a browser the whole page hangs until the entire request is received, and then it renders all at once.

Occasionally on longer requests it hangs for a while and then starts streaming data to the screen as it arrives, but I have not deduced the threshold where that happens.

Is there some header or other magic I can send to make the browser render the content as soon as it is availible?

Upvotes: 4

Views: 477

Answers (1)

Greg Bray
Greg Bray

Reputation: 15727

According to this related question you might be able to get it to work by using text/html as the content type (still need the charset=UTF-8 part too) or adding X-Content-Type-Options: nosniff to work around a webkit bug

Upvotes: 6

Related Questions