How to identify the browser?


#1

I need to generate some browser-specific code; can I identify which
browser is being used from within my RoR code?


#2

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.


#3

Check that out:
http://www.quirksmode.org/js/support.html


#4

inside an action controller method:

redirect_to “http://www.microsoft.com” if
request.env[“HTTP_USER_AGENT”].include?(“MSIE”)