in reply to Emulate CGI "server push" to show real time status of CGI script for all browsers
This is only off the top of my head and I haven't tested, but that's the rough idea. It's a bit of a hack, but I remember getting it to work in IE and Netscape (but that was 3yrs ago - there's probably a more acceptable method used today. Probably :)#!/usr/bin/perl use strict; use warnings; use CGI; # unbuffer output $|++; print $q->header(). $q->start_html. $q->start_form({-name=>'statusform'}). $q->textfield('status','',50,50). $q->end_form; for (0..100) { print_status("$_\% completed"); sleep(1); } print $q->end_html; exit(0); sub print_status { my $status = $_[0]; $status =~ s/'/\\'/g; print $q->script({-language=>'javascript'}, "document.statusform.status.value = '$status'\n" ); }
Looking at it it now, I'd probably use an iframe with the above hack and js page refresh every 30 seconds to avoid getting too big a page of js.
.02
cLive ;-)
|
|---|