in reply to Re: Content-Disposition... odd behavior in IE
in thread Content-Disposition... odd behavior in IE

No dice :(

The Cache-Control header didn't change a thing. But it does seem to be something to do with the cache. Almost like IE is deleting the file immediately after it creates it.

  • Comment on Re^2: Content-Disposition... odd behavior in IE

Replies are listed 'Best First'.
Re^3: Content-Disposition... odd behavior in IE
by tilly (Archbishop) on Jan 14, 2009 at 18:29 UTC
    Perhaps capitalization matters?
    #!/usr/bin/perl use strict; print "Content-type: application/octet-stream\n"; print "Cache-Control: private\n"; print "Content-Disposition: attachment; filename=big-test.csv\n\n"; print "Test,One,Two,Three\n"; exit;
    Update: And if that doesn't work, perhaps
    #!/usr/bin/perl use strict; print "Pragma: \n"; print "Cache-Control: \n"; print "Content-Disposition: attachment; filename=\"big-test.csv\"\n"; print "Content-type: application/octet-stream\n\n"; print "Test,One,Two,Three\n"; exit;
    (It is frustrating that I can't test these suggestions, but I don't have IE to test with and it is a browser issue.)

      Perhaps capitalization matters?

      Capitalisation is not suppose to matter for HTTP header names (but you never know), and you already rely on the case-insensitivity (by using "Content-type" instead of "Content-Type").

        Ah. I was just copying an example from somewhere.

        Really my experience with this kind of problem is that you keep trying variations that have worked for someone else and hopefully one of them finally does the trick.

        Glancing at some code I have lying around the following definitely works with many people's copies of IE:

        #! /usr/bin/perl -w use strict; use CGI; print CGI->header( -type => "application/vnd.ms-excel", -attachment => "example.xls", ); print "Salutation\tRecipient\nHello\tWorld\nGreetings\tEarthlings\n";
        So if that doesn't work I can guarantee that the problem is specific to his copy of IE, and is not shared by IE in general.
      Still no luck.

      After playing around with the cache idea in mind, I have noticed if the helper app is open the file opens sometimes (worked with Excel, but not Acrobat).

      This is confirmed with looking for files created in the cache folder.

      IE is either deleting or not creating the file in the cache.

        I would suggest trying another machine and seeing if it works. I would also recommend looking at your local browser settings and seeing whether IE has some preference set that could adversely affect its caching behavior.

        Good luck and welcome to the world of frustration and pain that is Microsoft.