How to send the browser to an error page if part of the response has been sent (chunked)

前端 未结 1 1033
忘掉有多难
忘掉有多难 2021-02-05 14:16

This is typical scenario: a page is evaluated, and there\'s a buffer - once the buffer is full, the part of the page that is evaluated is sent to the browser. This uses the HTTP

相关标签:
1条回答
  • 2021-02-05 14:20

    You cannot redirect from the server in a chunked encoding because the headers have already been sent. The only way to perform a redirect is to send a <script> tag from the server and perform a client side redirect. Just out of curiosity are you trying to implement a COMET server? If this is the case HTML5 WebSockets seem better way (if the browsers you are targeting support them of course) compared to the hidden iframe technique.

    0 讨论(0)
提交回复
热议问题