# Why are IE6 and Firefox rendering different formats from the same URL?

**URL:** <https://www.ruby-forum.com/t/why-are-ie6-and-firefox-rendering-different-formats-from-the-same-url/137663>\
**Category:** Rails\
**Created:** [May 15, 2008, 3:06am UTC](https://www.ruby-forum.com/t/why-are-ie6-and-firefox-rendering-different-formats-from-the-same-url/137663 "2008-05-15T03:06:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HSWade\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@HSWade\_M](https://www.ruby-forum.com/u/HSWade_M)\
**Post date:** [May 15, 2008, 3:06am UTC](https://www.ruby-forum.com/t/why-are-ie6-and-firefox-rendering-different-formats-from-the-same-url/137663/1 "2008-05-15T03:06:13Z")

</div>

I have a controller action in my Rails 2.0.2 app that looks like this:

def matrix  
@shows = Show.find(:all)  
@players = Player.find(:all)  
respond\_to do |format|  
format.html  
format.xls do  
set\_excel\_headers(headers,“matrix-#{@show\_year}-  
#{@show\_month}.xls”)  
end  
end  
end

In Firefox, this works exactly as expected - when I go to /signups/  
matrix, I get the HTML format rendered. If I go to /signups/  
matrix.xls, I get the Excel version.

However, when I do the same thing on IE6/XP, I get the Excel format  
rendered for both. /signups/matrix tries to download the Excel file.

The log doesn’t show anything odd that I can tell:

Processing SignupsController#matrix (for 192.168.119.1 at 2008-05-14  
20:03:57) [GET]  
Session ID: 39a88d1fff075058276e65d67136f7dd  
Parameters: {“action”=\>“matrix”, “controller”=\>“signups”}

[…]

Completed in 0.23381 (4 reqs/sec) | Rendering: 0.03932 (16%) | DB:  
0.09844 (42%) | 200 OK [[http://192.168.119.1/signups/matrix](http://192.168.119.1/signups/matrix)]

I’m stumped - does anyone know why this would be happening?

–Wade

---

<div class="post-metadata">

**Author:** ![HSWade\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@HSWade\_M](https://www.ruby-forum.com/u/HSWade_M)\
**Post date:** [May 15, 2008, 3:11pm UTC](https://www.ruby-forum.com/t/why-are-ie6-and-firefox-rendering-different-formats-from-the-same-url/137663/2 "2008-05-15T15:11:46Z")

</div>

The key to this behavior is the Accept header of the HTTP request. You  
can  
check it in Rails with request.headers[‘HTTP\_ACCEPT’] (see  
ActionController::AbstractRequest).

IE6 prefers MS Office content (Excel, Powerpoint, Word) over HTML:  
…  
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,  
application/vnd.ms-excel,  
application/msword, application/vnd.ms-powerpoint, _/_  
…  
(I got this from  
[http://www.ibm.com/developerworks/xml/library/x-tipapachexhtml/index.html](http://www.ibm.com/developerworks/xml/library/x-tipapachexhtml/index.html)  
as I don’t have IE6 installed.)

So (X)HTML mimetypes don’t even appear explicitly, they’re caught by the  
wildcard _/_ and have the lowest priority.

Very strange, but this is how Microsoft wanted it to be. They fixed this  
in  
the meantime. The Internet Explorer 8 beta header says simply:  
Accept: _/_

To be sure to get the HTML rendering, say /signups/matrix.html . I guess  
you could also tinker with your HTTP server settings to give the HTML  
mimetypes higher priority.

---

<div class="post-metadata">

**Author:** ![HSWade\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@HSWade\_M](https://www.ruby-forum.com/u/HSWade_M)\
**Post date:** [May 16, 2008, 1:56am UTC](https://www.ruby-forum.com/t/why-are-ie6-and-firefox-rendering-different-formats-from-the-same-url/137663/3 "2008-05-16T01:56:46Z")

</div>

Thanks for the tip - I went in and changed application/vnd.ms-excel to  
application/octet-stream in the initializer/mime\_types.rb file, and it  
seems to be performing expected behavior now.

Thanks again!

–Wade
