Forum: Ruby on Rails How to identify the browser?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Filip G. (Guest)
on 2006-03-02 16:00
I need to generate some browser-specific code; can I identify which
browser is being used from within my RoR code?
Peter E. (Guest)
on 2006-03-02 17:32
(Received via mailing list)
Filip G. (Guest)
on 2006-03-02 17:42
Peter E. wrote:
> Check that out:
> http://www.quirksmode.org/js/support.html

Thanx but that's from within Javascript. I need to detect the browser
from within Rails. The reason is that IE needs a doctype declaration to
lay out my site properly, but in Firefox some of my javascripts don't
work anymore if I include a doctype. So I'd just like to send the
doctype to IE browsers.
Peter E. (Guest)
on 2006-03-02 18:02
(Received via mailing list)
inside an action controller method:

redirect_to "http://www.microsoft.com" if
request.env["HTTP_USER_AGENT"].include?("MSIE")
This topic is locked and can not be replied to.