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

I have a script that emails reports to our staff once a month. The reports are HTML emails with several graphs giving an overview of where each department stands financially. Along with the graphs is a listing of accounts; each account is a link to a script that generates a more detailed report for that account. This approach works fine under Internet Explorer, but when users who use Firefox click on a link they are presented with a dialog box in Firefox asking what program they want to use to open financial_dashboard_detail.pl (the name of the script) "which is a: application/octet-stream from http://mungedaddress/cgi-bin/".

Any ideas on what I need to do to make this open properly in Firefox?

Thanks!

Replies are listed 'Best First'.
Re: Script opening in Firefox
by Juerd (Abbot) on Oct 21, 2004 at 18:42 UTC

    Contrary to what Internet Explorer does in most situations, Firefox actually works by the standard and decides things based on the headers that you send, the most important of those being Content-Type. Set it to the actual content type (text/html for HTML, application/msword for Word documents, etcetera) and things magically begin to work as expected. Note that Firefox doesn't embed things like Excel, so that a spreadsheet won't display automatically in the browser window.

    The "file extension" should really not make ANY difference. Deciding based on it is bad, and Firefox, to the best of my knowledge, never does that. Internet Explorer does, and by doing so makes things hard for developers. I believe that whether the URL ends in ".cgi" or ".pl" will make absolutely no difference at all for Firefox.

    Another thing to look at is Content-Disposition. Set it to inline, not attachment.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      Thanks for your insight. I've grown so used to programming with CGI::Application (which takes care of headers) that I didn't even think about sending headers in this script that doesn't use CGI::App.

      Adding print header fixed things. =)

Re: Script opening in Firefox
by amt (Monk) on Oct 21, 2004 at 18:31 UTC
    It seems like it something that is configured with Firefox, try renaming the file to a more acceptable CGI application filename, i.e. some.cgi. This shouldn't affect IE's operation.
    amt.

    perlcheat