Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Read the previous post on this and found no answer that worked for me. Spoke with another programmer and he said his server did something to the "server configuration" to get his script to work in Netscape. Running on an Unix server w/Apache, and it outputs the html code in the browser (Netscape). Try for yourself - go to www.pcworldlinks.com - click logo. Thanx Again. CA

Replies are listed 'Best First'.
Re: Working for IE
by chromatic (Archbishop) on Jun 15, 2000 at 06:29 UTC
    Is the mime-type set correctly for text/html? IE tends to ignore this, while Netscape doesn't. I'll try to telnet in and see if that's the case.

    Yep, here's the server headers:

    GET /cgi-bin/cgiwrap/pcworldlinks/frontpage.pl HTTP/1.0 HTTP/1.1 200 OK Date: Thu, 15 Jun 2000 02:36:16 GMT Server: Apache/1.3.9 (Unix) Client file=./DIST/.dat<br>Content-Type: text/html Connection: close Content-Type: text/plain
    That last one should be text/html.
      Well, i knew someone would probably figure out the problem. Thank you. Now, one other thing. How do I correct this as I'm leasing the web space, or am I missing something. (i.e. this is a script problem) Thanks again for your help and darn quick responses. CA
        You need to return the content-type in the HTTP header somehow, whether through CGI.pm's header() method, or by printing it:
        print "Content-Type: text/html\n\n";
        That's the canonical way you'll see it written. This has to be the first thing out of your script, though, as anything after the two newlines (technically something like \012\015\012\015) will be displayed in the browser.
Re: Working for IE
by Anonymous Monk on Jun 15, 2000 at 08:05 UTC
    Okay, duh! I found how to post properly so you can see my script. Sorry about the earlier jarbled mess. Thanks again for your input. CA
    #!/usr/local/bin/perl BEGIN{unshift(@INC,"/usr/local/www/htdocs/pcworldlinks/cgi-bin/")}; use Cart; $path="/usr/local/www/htdocs/pcworldlinks/cgi-bin/DIST/"; %ele=Cart::cgiparse; if(!($ele{dist})){$dist=$ENV{'QUERY_STRING'};}else{$dist=$ele{dist};} %var=Cart::get_client($dist,$path); print "Content-Type: text/html\n\n"; if ($ele{dist}=~ /[guestmember]/i){ print <<"EOF"; <HTML> <HEAD> <script language="JavaScript"><!--- Hide from tired old browsers function go(url){ opener.parent.main.location.href=url; } // End hiding ---> </script> <base href="http://www.pcworldlinks.com/"> </HEAD> <TITLE>Welcome to Pro Celebrity Golf & Travel</TITLE> <frameset cols=16%,84% frameborder=no border=0 framespacing=0 noresize +=yes> <frame src="framedpgs/toolbarmg.htm" name="toolbar" scrolling=auto marginwidth=0 marginheight=0 noresize=yes> <frame src="Mainpage1.shtml" name="main" scrolling=auto marginwidth=0 marginheight=0 noresize=yes> </frameset> </frameset> <noframes> You need a frames capable browser to view this page. </noframes> </HTML> EOF }else{ print <<"EOF"; <HTML> <HEAD> <script language="JavaScript"> <!--- Hide from tired old browsers function go(url){ opener.parent.main.location.href=url; } // End hiding ---> </script> <base href="http://www.pcworldlinks.com/"> </HEAD> <TITLE>$var{title}</TITLE> <frameset cols=15%,* frameborder=no border=0 framespacing=0 noresize=y +es> <frame src="cgi-bin/cgiwrap/pcworldlinks/toolbarir.pl?$var{dist}" name +="toolbar" scrolling=auto marginwidth=0 marginheight=0 noresize=yes> <frameset rows=28%,*> <frame src="cgi-bin/cgiwrap/pcworldlinks/irnfo.pl?$var{dist}" name="ir +nfo" marginwidth=0 marginheight=0 scrolling=no> <frame src="cgi-bin/cgiwrap/pcworldlinks/main.pl?$var{dist}" name="mai +n" scrolling=auto marginwidth=0 marginheight=0 noresize=no> </frameset> </frameset> <noframes> You need a frames capable browser to view this page. </noframes> </HTML> EOF }
      That much looks okay. You might move the print "Content-Type: text/html\n\n"; line to before the Cart::cgiparse() call. (It may print its own headers, screwing things up.)

      Otherwise, you'll have to check the server configuration. That's probably beyond the scope of Perl Monks.