# New mime type. Works in windows, fails in ubuntu

**URL:** <https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951>\
**Category:** Rails\
**Created:** [April 16, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951 "2008-04-16T15:45:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [April 16, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951/1 "2008-04-16T15:45:21Z")

</div>

Hi,

I am generating some SVG content from my app. To get that working I’ve  
done the next:

Add line in /config/initializers/mime\_types.rb$:  
Mime::Type.register “application/xhtml+xml”, :svg

In my controller I have now added to the respond\_to:  
format.svg { render :action =\> “svg.rhtml”, :layout =\> false }

svg.rhtml is something like:  
  
\<% for session in @online\_sessions %\>  
\<text id=“user” x=“325” y=“80” width=“200” height=“20” … \>  
\<%= getUsernameFromID(session.user\_id) %\>  
  
\<% end %\>

* * *

Now. When I have the new line in the mime\_types.rb and try to access the  
app I get:

“This XML file does not appear to have any style information associated  
with it. The document tree is shown below.”

The only thing I see is the XML model. No layout.

If I remove the new line then everything works 8-P

The funny thing is that all works fine in the environment I use in  
Windows with InstantRails. And the same thing causes this effect when I  
run it in Ubuntu. Same versions for everything and using webrick as  
server in both.

Any good ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [April 16, 2008, 9:48pm UTC](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951/2 "2008-04-16T21:48:51Z")

</div>

Hi again,

I have to make some corrections to my problem. I have verified that the  
guilty one is not Ubuntu.

The problem I describe only occurs with Firefox (!?!). When adding the  
new mime type accessing any page of the application just returns the  
data model in XML. No layout.

There is no such problem if I use IE or Opera. Behaves same with  
InstantRails or directly in the Ubuntu machine.

Any clues to solve the mistery?

Cheers.

---

<div class="post-metadata">

**Author:** ![comopasta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/59ef9b/32.png) [@comopasta](https://www.ruby-forum.com/u/comopasta)\
**Post date:** [April 16, 2008, 10:07pm UTC](https://www.ruby-forum.com/t/new-mime-type-works-in-windows-fails-in-ubuntu/134951/3 "2008-04-16T22:07:36Z")

</div>

Hi again again,

So now I think I fixed the problem. The MIME type was wrong.  
I had Mime::Type.register “application/xhtml+xml”, :svg

And the right one was Mime::Type.register “image/svg+xml”, :svg

I don’t know why only Firefox was affected but now those three browsers  
get the right stuff from the server.

Cheers!
