• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pure Code (Need Help)  RSS feed

 
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've created an application (CGI) that, when run on Linux, works fine in Internet Explorer but just shows code in Netscape. Its a Perl script and the customer wanted the Content-type header to be put in each document at the top of the page, but obviously not to show. I was wondering if the Content-type would affect the page displaying just as text? Also when they put the script in their prep site the Content-Type: text/html actually prints at the top of the page. Any suggestions?
(roberthpike@yahoo.com)
Rob
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Content-Type header is what you want. IE will (I think) use the file extension rather then honoring the content-type (and it probably thinks *.cgi or whatever you have is supposed to be html). NS uses Content-Type, and is probably defaulting to text/plain.
The Content-Type thing goes in the HTTP header, not "at the top of the page".
I'm a bit fuzzy on CGI (it's been a long time), so I forget how you actually set headers (and it depends on what language and libs all you are using).
But if I remember right, the returned HTTP stream looks something like:

[ September 20, 2002: Message edited by: Dave Landers ]
 
Saloon Keeper
Posts: 18800
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To work properly, the MIME-type settings need to be setup properly on both clients and servers. In the case of a CGI, you also have to have it stored in a place that the webserver knows is a script source.
In IIS, you set these attributes up in the IIS console GUI. For Apache, you use the <Script-Alias> and module directives, plus you'll usually have to setup the MIME type too,
On the client side, the MIME setup handles what is done with the output. I.e., brings up a copy of MS-WORD, saves the data to disk, and so forth. If you're seeing the raw Perl code in some, but not all browser windows, chances are that the MIME registry (which is infernally well-hidden in Windows IE) is sensitive to the data format.
Just to make it better "Internet Explorere is an Integral Part of Microsoft Windows", so sometimes you may see effects even when using Netscape (which has its own MIME definition list).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!