×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CGI-script doesn't work in Firefox

CGI-script doesn't work in Firefox

RE: CGI-script doesn't work in Firefox

Looks likee you aren't sending the proper MIME type. Before you start pumping out the HTML, you need to send a header telling the browser to expect HTML instead of plain text:

something like this:

CODE

print "Content-type: text/html\n\n";

-- Chris Hunt
Webmaster &  Tragedian
Extra Connections Ltd

RE: CGI-script doesn't work in Firefox

Is this some type of embedded perl code?  Maybe firefox needs to be setup in some way to run the embedded perl code if that's the case.

RE: CGI-script doesn't work in Firefox

ChrisHunt is right on the money.  While his example does resemble a Perl statement, that's not his point. The CGI program must tell the server what type of document it is returning.

Quote (NCSA CGI Primer):

CGI programs can return a myriad of document types. They can send back an image to the client, and HTML document, a plaintext document, or perhaps even an audio clip. They can also return references to other documents. The client must know what kind of document you're sending it so it can present it accordingly. In order for the client to know this, your CGI program must tell the server what type of document it is returning.
NCSA CGI Primer

The difference between Firefox and IE in this context is that, if the document doesn't specify it's content type, IE assumes text/html and Firefox simply shows you the document.

I feel that Firefox's approach in this case is more appropriate, but I'm not sure that either browser is breaking any rules.

CGI and Perl (even Embedded Perl) run on the server side.  Neither Firefox or IE can run embedded Perl... but that was just a simple print command that is almost the same in most programming languages.

Try one of these:

CODE

/* Only one newline needed for Java because println already appends one */
system.out.println( "Content-Type: text-html\n" );

/* C */
printf( "Content-Type: text/html\n\n" );

/* PHP or Perl */
print( "Content-Type: text/html\n\n" );

# bash, bourne, or korn shell
echo "Content-Type: text/html\n\n";

The important part is that it has to be the first line of output.

In summary, I never like to make this the only response, but... RTFM

--
-- Ghodmode

RE: CGI-script doesn't work in Firefox

well, as far as I know, if there is no http header printed, the script will die when it tries to print something to the browser, so there must be some type of header. Maybe the OP will post his code (if it's not too long).

RE: CGI-script doesn't work in Firefox

(OP)
Thanks for input, I will try and see if it's work!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close