我想显示一条消息,在我的网页的实际内容与加载的页面一起显示消息之前,请阅读“正在加载......请稍候”。但是,在Apache 2.2.15上,如果不先打印标题,则不会显示打印消息。下面是代码: (Perl版本5.14.1,CGI版本:3.52):如何在使用CGI的页眉之前打印页面加载消息Perl
use CGI;
use CGI::Carp qw(fatalsToBrowser);
#print "Content-type:text/html\n\n";
print '<pre>'. " This is before header" .'</pre>';
print qq[<DIV id="loading" style="position:absolute; font-family:arial;
font-size:16; left:0px; top:0px; background-color:red; layer-background-
color:white; height:100%; width:100%;">
<TABLE width=100%><TR><TD><B>Loading... Please wait!</B></TD></TR></TABLE>
</DIV>];
my $q = CGI->new;
print $q->header();
print $q->start_html();
warn "this is test header issue script \n";
print "Hello Everybody .. !";
print $q->end_html();
如果我打印“内容类型:text/html的”顶部,然后我能够显示加载消息,但是这也打印了我不想要的顶部的内容类型。
有没有一种Perl的方式来实现这一目标?
这只是我的实际代码的一个简短而简单的例子,所以在打印加载消息之后,代码的控制将不会继续进行,请忽略它。