1

<?php
echo 'first<br>';
ob_flush();
flush();
file_get_contents("http://ttt.tt");
echo "second";

http://ttt.tt is not reachable. so in browser we can see the output "first" and then wait for "30s"/Maximum execution time of each script/ there will output "second". in IE、FF, it works ok.
but in chrome,"first" && "second" will output together.

my english is bad.i Don't know if you understand.help!!!

i also tried to disable browser's cache like this:
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

but problems still exist..

Zaric Zhang
  • 99
  • 1
  • 7

3 Answers3

1

You don't need to disable cache. It's all about content type encoding. What I simply did was:

header('Content-Type: text/html; charset=UTF-8');

Initially it was:

header('Content-Type: text/html');

... which didn't work. Specifying "charset=UTF-8" immediately forced Chrome to render chunked responses.

esengineer
  • 9,514
  • 7
  • 45
  • 69
0

Problem may be that "Pragma: no-cache" won`t work every time. The HTTP specification does not set any guidelines for Pragma response headers. Try to use "Expires".

If you need additional info, here is the link to web caching tutorial.

Siblja
  • 859
  • 2
  • 12
  • 19
0

One option is to add X-Content-Type-Options: nosniff.

See Chunked transfer encoding - browser behavior for a thorough explanation.

Daniel F
  • 13,684
  • 11
  • 87
  • 116