Re: Browser Problem
Hello Curtis, It works!! Start Perl stuff... End Perl stuff... print< base-02.html Content container The:- print "Content-type: text/html\n\n"; produced a error in the browser for some reason. Many thanks for all your help. (I am not entirely certain of what is going on but it works!) Now I have to sort out the html/browser discrepancy problems. Opera and IE5.5 are pretty close but Netscape is doing strange things with my layout. Thanks again, Vance. --- --- Advance Design - Vance <[EMAIL PROTECTED]> wrote: > Hello Curtis, > > I am just returning a complete html document from the perl file ... Vance, It sounds like that could be the problem. Generally, when printing a Web page from a CGI script, you need to supply a content-type header to let the user agent (browser, in this case) know what type of content it's dealing with. If you're not doing that, your Web server might be doing that for you and sending a default of 'text/plain', or perhaps it's not sending it at all the the browsers are using defaults? Tough to say what's going on here. If you are not printing anything before the Web page, try printing the following: print "Content-type: text/html\n\n"; That will add the content-type header. Even better, try this (tougher to make a typo with this method): use CGI qw/:standard/; print header(); It sounds like you may be a little unsure as to what is meant by headers, so I'll try to explain, just in case. Your browser, when you request a resource from a Web server, will issue a request. There are many different request methods, but for CGI programmers, you will primarily be dealing with GET and POST requests. A typical request sent from your browser to the server may resemble the following: POST /cgi-bin/somescript.cgi HTTP/1.1 Accept */* Accept-Language: en-us Accept-encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) Host: www.someserver.com Connection: Keep-Alive color=red&name=Ovid Note that this request is split into two sections. The first section is comprised of the headers and the second section is the "entity body", or just "body". Since this is a POST request (see first line), "form" data is put in the entity body. If this were a GET request, there would be no body and the first line would be something like (note the query string moved from the body) GET /cgi-bin/somescript.cgi?color=red&name=Ovid HTTP/1.1 For a get request like the one above, you'll see something like the following in the address bar of your browser: http://www.someserver.com/cgi-bin/somescript.cgi?color=red&name=Ovid The Web server receives the request and passes your query information to the CGI script. When the CGI script responds, it is expected to send at least a Content-type header (unless your using non-parsed header scripts, which I won't go into now) or a status header (which I also won't go into now). Your Web server supplies the rest of the headers. Here's a typical response: a Web page sent by a script: HTTP/1.1 200 OK Date: Thu, 23 Sep 2001 06:23:19 GMT Server: Apache/1.3.6 (Unix) Last-Modified: Mon, 20 Sep 2001 08:19:56 GMT ETag: "2f5cd-9640381-e1bd6" Accept-Ranges: bytes Content-length: 4295 Connection: close Content-type: text/html base-02.html etc. Note that we again have headers and a body, just as an HTML document has a head and body, but we're talking apples and oranges here. Your script is expected to at least specify the content-type (note the last line of the headers) and the Web server usually provides the rest of the headers. The two newlines between the headers allows your browser to know where the headers stop and the entity-body begins. Typically, when you "view source" in a Web browser, you're seeing *only the entity-body* of the document that's been returned. Hope this clears up the confusion. For more information, you can read http://www.easystreet.com/~ovid/cgi_course/. Cheers, Curtis Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: Browser Problem
--- Advance Design - Vance <[EMAIL PROTECTED]> wrote: > Hello Curtis, > > I am just returning a complete html document from the perl file ... Vance, It sounds like that could be the problem. Generally, when printing a Web page from a CGI script, you need to supply a content-type header to let the user agent (browser, in this case) know what type of content it's dealing with. If you're not doing that, your Web server might be doing that for you and sending a default of 'text/plain', or perhaps it's not sending it at all the the browsers are using defaults? Tough to say what's going on here. If you are not printing anything before the Web page, try printing the following: print "Content-type: text/html\n\n"; That will add the content-type header. Even better, try this (tougher to make a typo with this method): use CGI qw/:standard/; print header(); It sounds like you may be a little unsure as to what is meant by headers, so I'll try to explain, just in case. Your browser, when you request a resource from a Web server, will issue a request. There are many different request methods, but for CGI programmers, you will primarily be dealing with GET and POST requests. A typical request sent from your browser to the server may resemble the following: POST /cgi-bin/somescript.cgi HTTP/1.1 Accept */* Accept-Language: en-us Accept-encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT) Host: www.someserver.com Connection: Keep-Alive color=red&name=Ovid Note that this request is split into two sections. The first section is comprised of the headers and the second section is the "entity body", or just "body". Since this is a POST request (see first line), "form" data is put in the entity body. If this were a GET request, there would be no body and the first line would be something like (note the query string moved from the body) GET /cgi-bin/somescript.cgi?color=red&name=Ovid HTTP/1.1 For a get request like the one above, you'll see something like the following in the address bar of your browser: http://www.someserver.com/cgi-bin/somescript.cgi?color=red&name=Ovid The Web server receives the request and passes your query information to the CGI script. When the CGI script responds, it is expected to send at least a Content-type header (unless your using non-parsed header scripts, which I won't go into now) or a status header (which I also won't go into now). Your Web server supplies the rest of the headers. Here's a typical response: a Web page sent by a script: HTTP/1.1 200 OK Date: Thu, 23 Sep 2001 06:23:19 GMT Server: Apache/1.3.6 (Unix) Last-Modified: Mon, 20 Sep 2001 08:19:56 GMT ETag: "2f5cd-9640381-e1bd6" Accept-Ranges: bytes Content-length: 4295 Connection: close Content-type: text/html base-02.html etc. Note that we again have headers and a body, just as an HTML document has a head and body, but we're talking apples and oranges here. Your script is expected to at least specify the content-type (note the last line of the headers) and the Web server usually provides the rest of the headers. The two newlines between the headers allows your browser to know where the headers stop and the entity-body begins. Typically, when you "view source" in a Web browser, you're seeing *only the entity-body* of the document that's been returned. Hope this clears up the confusion. For more information, you can read http://www.easystreet.com/~ovid/cgi_course/. Cheers, Curtis Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Browser Problem
Hello Curtis, I am just returning a complete html document from the perl file using the following: (perl in blue, html in red) Start Perl stuff... End Perl stuff... print< base-02.html Content container Your email suggests I should have a content-type header included in here somewhere... ? Thanks for your help. Vance [EMAIL PROTECTED] www.advance-design.co.uk --- Advance Design - Vance <[EMAIL PROTECTED]> wrote: > Hello > I have written some web pages incorporating Forms and Perl processing on the server. >Everything > works fine on my IE 5.5 Browser but when I use the Netscape 4.7 and Opera 5.12 >browsers, the > HTML sent back from the Perl programme appears as (source) text. > Do you have any ideas why. > > Thanks > Newer versions of Internet Explorer have a "feature" that examines that beginning of >the data that > it receives and attempts to render the data accordingly. It completely violates W3C >standards by > ignoring the content-type header. Many, many developers have been bitten by this >bug. I've > accidently sent GIFs with a content type of image/pjpeg and IE still rendered it >correctly but > Netscape didn't. That was less than fun to debug. > In your script, find out what is responsible for printing the content-type header >and post that > code snippet here. It will be something like the following: > # If you're doing it by hand, it will resemble this: > print "Content-type: text/html\n\n"; > # If you're using CGI.pm, it will resemble on of the two following lines: > print header(); > # or (varies depending on the name of the CGI object) > print $query->header; > There are many different ways of printing the content-type header, but they will >likely resemble > the snippets above. Send that and we may have an answer for you. > Of course, you can also telnet to port 80 (assuming that's the telnet port) and view >the headers > that way). Most likely, you're sending a content type of 'text/plain'. Here's what >you'd enter > in telnet: > GET /cgi-bin/somescript.cgi?foo=bar HTTP/1.1 > Host: www.somehost.com > Substitute your own host and path and make sure you have two newlines after the host >header. > Cheers, > Curtis Poe > = > Senior Programmer > Onsite! Technology (http://www.onsitetech.com/) > "Ovid" on http://www.perlmonks.org/ > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/
Re: Fw: Browser Problem
--- Advance Design - Vance <[EMAIL PROTECTED]> wrote: > Hi Joel, > Thanks for the fast reply. > This is the html document heads. > > I have tried "messing" about with these, but with > no change in result. > > Transitional//EN"> > > > base-02.html > > > > content="keyword,keyword"> > Actually, that's the head of the HTML document. What's needed are the headers that are sent *prior* to that. Those headers tell the user agent (the browser, in this case) what to do with the document. Cheers, Curtis Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Browser Problem
Check any 'Content-type' header that you send. The header should be 'Content-type: text/html'. If you are not sending a 'Content-type' header, then you should be. To do this simply put one of the following statements in your code: # if you are using Lincoln Stein's CGI.pm module. print CGI->header(); or # if you are NOT using Lincoln Stein's CGI.pm module. print "Content-type: text/html\n\n"; The reason the HTML is being read as plain text, is due to the fact Netscape and Opera are being the content is 'Content-type: text/plain'. Bradley M. Handy Senior Programmer/Owner Jack-of-all-trades Programming Services --www.jack-of-all-trades.net --mailto:[EMAIL PROTECTED] > -Original Message- > From: Advance Design - Vance [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 23, 2001 2:18 PM > To: [EMAIL PROTECTED] > Subject: Browser Problem > > > Hello > I have written some web pages incorporating Forms and Perl > processing on the server. Everything works fine on my IE 5.5 > Browser but when I use the Netscape 4.7 and Opera 5.12 browsers, > the HTML sent back from the Perl programme appears as (source) text. > Do you have any ideas why. > > Thanks > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fw: Browser Problem
Hi Joel, Thanks for the fast reply. This is the html document heads. I have tried "messing" about with these, but with no change in result. base-02.html Thanks, Vance. [EMAIL PROTECTED] - Original Message - From: "Joel Hughes" <[EMAIL PROTECTED]> To: "Advance Design - Vance" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, August 23, 2001 7:29 PM Subject: RE: Browser Problem > maybe you've made a mistake with your HTTP headers which IE5.5 is being > forgiving about but Opera and Netscape are complaining about (Opera is quite > strict - which is good of course!). > > Can you check the headers that you are producing and post them to the group? > > regards > > Joel > > -Original Message- > From: Advance Design - Vance [mailto:[EMAIL PROTECTED]] > Sent: 23 August 2001 19:18 > To: [EMAIL PROTECTED] > Subject: Browser Problem > > > Hello > I have written some web pages incorporating Forms and Perl processing on the > server. Everything works fine on my IE 5.5 Browser but when I use the > Netscape 4.7 and Opera 5.12 browsers, the HTML sent back from the Perl > programme appears as (source) text. > Do you have any ideas why. > > Thanks > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Browser Problem
--- Advance Design - Vance <[EMAIL PROTECTED]> wrote: > Hello > I have written some web pages incorporating Forms and Perl processing on the server. >Everything > works fine on my IE 5.5 Browser but when I use the Netscape 4.7 and Opera 5.12 >browsers, the > HTML sent back from the Perl programme appears as (source) text. > Do you have any ideas why. > > Thanks Newer versions of Internet Explorer have a "feature" that examines that beginning of the data that it receives and attempts to render the data accordingly. It completely violates W3C standards by ignoring the content-type header. Many, many developers have been bitten by this bug. I've accidently sent GIFs with a content type of image/pjpeg and IE still rendered it correctly but Netscape didn't. That was less than fun to debug. In your script, find out what is responsible for printing the content-type header and post that code snippet here. It will be something like the following: # If you're doing it by hand, it will resemble this: print "Content-type: text/html\n\n"; # If you're using CGI.pm, it will resemble on of the two following lines: print header(); # or (varies depending on the name of the CGI object) print $query->header; There are many different ways of printing the content-type header, but they will likely resemble the snippets above. Send that and we may have an answer for you. Of course, you can also telnet to port 80 (assuming that's the telnet port) and view the headers that way). Most likely, you're sending a content type of 'text/plain'. Here's what you'd enter in telnet: GET /cgi-bin/somescript.cgi?foo=bar HTTP/1.1 Host: www.somehost.com Substitute your own host and path and make sure you have two newlines after the host header. Cheers, Curtis Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Browser Problem
maybe you've made a mistake with your HTTP headers which IE5.5 is being forgiving about but Opera and Netscape are complaining about (Opera is quite strict - which is good of course!). Can you check the headers that you are producing and post them to the group? regards Joel -Original Message- From: Advance Design - Vance [mailto:[EMAIL PROTECTED]] Sent: 23 August 2001 19:18 To: [EMAIL PROTECTED] Subject: Browser Problem Hello I have written some web pages incorporating Forms and Perl processing on the server. Everything works fine on my IE 5.5 Browser but when I use the Netscape 4.7 and Opera 5.12 browsers, the HTML sent back from the Perl programme appears as (source) text. Do you have any ideas why. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Browser Problem
Hello I have written some web pages incorporating Forms and Perl processing on the server. Everything works fine on my IE 5.5 Browser but when I use the Netscape 4.7 and Opera 5.12 browsers, the HTML sent back from the Perl programme appears as (source) text. Do you have any ideas why. Thanks