I need to generate some browser-specific code; can I identify which
browser is being used from within my RoR code?
Peter E. wrote:
Check that out:
Javascript - Object detection
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.
inside an action controller method:
redirect_to “http://www.microsoft.com” if
request.env[“HTTP_USER_AGENT”].include?(“MSIE”)