I am trying to implement the trick listed on this page http://developer.yahoo.com/performance/rules.html#flush "Flush the Buffer Early".
Everytime I try to run this thing I am not getting the desired output.
I have written the following code.
<html>
<head>
<title>This is title</title>
<script type="text/javascript" src="/1.js"></script>
<link rel="stylesheet" type="text/css" href="/1.css">
</head>
<body>
ABC
<?php
flush();
sleep(3);
?>
</body>
</html>
The result
I am getting the same result on both Firefox and Chrome.
What I expect is that the download of CSS and JS files should start immediately, and not wait for 3 seconds.
Based on the information given on the internet, I have tried the following things but nothing has helped.
1. ob_start(); and then ob_flush();
2. Using both ob_flush(); and flush(); ( in both the orders )
3. Adding the thing like this
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
4. Putting more content in body 4~5 KB of content before flush.
5. And many other things.
I doubt if achieving this kind of thing is actually possible.