Years ago I wrote CGI programs at previous jobs that relied on progressive rendering, since those CGI programs could take a long time (minutes) to run, producing a line of output approx every second. I find that today, I cannot get progressive rendering to occur even with the simplest example.
I've seen a lot of suggestions on this topic about where to put CSS, scripts, etc. However, the trivial example below has none of that.
I don't see anywhere where browsers have an option to affect progressive rendering. I have tried this on several systems/devices with several browsers (chrome, firefox, opera), all with the same result.
Below is a trivial example that I expect to produce some output every 2 seconds, but instead it renders when the whole document is complete. Am I missing something obvious?
#!/usr/bin/env perl
select(STDOUT); $| = 1; # don't buffer stdout
print "Content-Type: text/html\; charset=ISO-8859-1\n\n" ;
print "<html> <head> <title> Testing </title> </head> <body>\n" ;
my $message = "<code>" .
"Why doesn't this render immediately? <br>\n" x 5 .
"</code>\n" ;
for ( my $i=0 ; $i < 5 ; $i++ ) {
print "$message\n" ;
sleep(2) ;
}
print "</body></html>\n" ;