--- mario kulka <[EMAIL PROTECTED]> wrote: > I'm using the following to print HTML to the browser: > > print <<"HTML code"; > > "my html here" > > HTML code > > It works fine in IE but when I execute the script under Netscape it displays > the source instead of loading the page based on the source. Please help. > Mariusz
Hi Mariusz, You need to ensure that you are printing a proper header: use CGI ':standard'; print header(); print <<"END_HTML"; ... The reason it's working in IE is because someone at Microsoft had the brilliant idea that when you someone sends a content type, they might not send the right content type. Rather than require people to send the correct data, IE just guesses what the content type should be based upon the first few lines of data. Further, even if you forget the extra newline before your entity-body and lump the content in with the headers, IE still tries to get things righ. Unfortunately, this means that many things "work" with IE, but appear broken in other Web browsers. The most common problem is someone sending the wrong content type for an image, but IE getting it right and if the person never tests with other browsers, they don't see that there's a problem. It also means that if you want to show the source of a Web page, the following will no longer work with IE: use CGI qw':standard'; print header('text/plain'); print <<'END_HTML'; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Some Title</title> </head> <body> This is the body </body> </html> END_HTML Instead, you have to assign the HTML to a variable and then use something like HTML::Entities to properly encode it and then print it out as HTML. Many people have been bitten by Microsoft deciding to second-guess us. (It's also opened up some nasty security holes). Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]