XHTML mime type

Jérémie Horhant
Fri, 27 Nov 2009 16:51:34 -0000

Hello,

    I''m trying to insert inline SVG in my XHTML pages but I realized
that rails serves XHTML pages with content-type header set to
"text/html; charset=utf-8". It''s definitely not cool and it
should be
"application/xhtml+xml, charset=utf-8".

So I''ve added a mime type line in initializer :

/    Mime::Type.register "application/xhtml+xml", :xhtml/

I also modified my controllers to use xhtml mime type.

/    respond_to do |format|
      format.xhtml # index.xhtml.erb
      format.xml  { render :xml => @users }
    end


/And finally rename my views *.html.erb became *.xhtml.erb.

This modifications works well but i have a few questions :

1 - Is there a more straightforward / elegant solution ?
2 - How can I handle browsers that don''t understand
application/xhtml+xml content type ?

Thanks in advance
Titinux.

--

You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at