Forum: Ruby on Rails Determining 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.
F2a8e4cc069558b818508c80052f2f5e?d=identicon&s=25 Brent Johnson (Guest)
on 2006-03-21 20:54
(Received via mailing list)
Is there a way I can read the user agent or something similar to
determine whether the person is using IE, Mozilla/Netscape, Opera,
Safari, etc?  I want to dynamically output the CSS to the browser, but
I'd like to change certain things (in this case the widths of some
divs since IE adds borders and padding size to the total size of a div
unlike firefox).

Thanks,

- Brent
36958dd94ca666a38483df282a5214d5?d=identicon&s=25 Peter Ertl (Guest)
on 2006-03-21 21:03
(Received via mailing list)
check that...

if (request.env['HTTP_USER_AGENT'].include?("IE"))
  #internet explorer
end


By the way: could you invite me to gmail?

Regards
Peter
36958dd94ca666a38483df282a5214d5?d=identicon&s=25 Peter Ertl (Guest)
on 2006-03-21 21:07
(Received via mailing list)
here's a (somehow boring) list of browser id's

http://www.zytrax.com/tech/web/browser_ids.htm
F2a8e4cc069558b818508c80052f2f5e?d=identicon&s=25 Brent Johnson (Guest)
on 2006-03-21 22:55
(Received via mailing list)
Thanks, thats quit an extensive list.  I really only care about IE,
Firefox/Mozilla/Netscape, Opera and Safari.  But how do I read the
user agent in RoR?  I checked the request object and poked around
searching the wiki and I can't find a way.  I'm sure there is, I'm
just looking over it I think.

- Brent
F2a8e4cc069558b818508c80052f2f5e?d=identicon&s=25 Brent Johnson (Guest)
on 2006-03-21 23:12
(Received via mailing list)
Oops, sorry!  Didn't see this response since gmail folded it up, and
yes, invite sent.

Thanks!

- Brent
This topic is locked and can not be replied to.