Tuesday, June 29, 2010

IE8: content-disposition:inline, opens as download

Problem:
We just had a pretty weird problem. Internet Explorer 8 decided to open some links as downloads instead of just navigating to the files as per usual. All normal browsers did not have this problem. I immediately checked the headers which revealed nothing out of the ordinary:

Server: Apache-Coyote/1.1
Cache-Control: public
Expires: Thu, 12 Jul 2012 19:13:38 GMT
Pragma: Thu, 12 Jul 2012 19:13:38 GMT
Content-Disposition: inline; filename="Recipe_Details_Attachments.htm"
Content-Type: text/html
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Tue, 29 Jun 2010 19:13:38 GMT
Connection: close 
 
The Content-Disposition: inline; part tells me that the browser should not open this as a download.

Solution:
My coworker who i now owe 6 beers suggested that because of IE's stupidity it is looking at the entire Content-Disposition line, and doing substring matching on first 'attachment' and then 'inline'. He was correct. IE stupidly saw this line as basically Content-Disposition:attachment;

The fix was to change the filename to something that did not include 'attachments'.

3 comments:

  1. Wow, that is absolutely retarded. Fuck Microsoft.

    ReplyDelete
  2. Yeah absolutely. We have code that renames any files containing the string 'attachment' to 'btachment' when IE is used as a browser. It's one of the strangest browser hacks in our code base.

    ReplyDelete
  3. fucking fanboys. now you'll claim this https://bugzilla.mozilla.org/show_bug.cgi?id=229075 is not just as retarded because it's a glorious open sores project.

    goddamn incompetent hypocrites.

    ReplyDelete