Hey all, I'm looking for the best way to detect browser, especially I'm looking to distinguish browsers as three different groups: ie6 and older, netscape4 and older browsers ie7 khtml/webkit/gecko/opera browsers
any idea?
thanx in advance
Pat
Hey all, I'm looking for the best way to detect browser, especially I'm looking to distinguish browsers as three different groups: ie6 and older, netscape4 and older browsers ie7 khtml/webkit/gecko/opera browsers
any idea?
thanx in advance
Pat
Don't know if it's the best way, but you can get the User-Agent in the controller with request.env['HTTP_USER_AGENT'].
b
Patrick Aljord wrote:
Will this work?
case request.user_agent when /(gecko|opera|konqueror|khtml|webkit)/i return :gecko when /msie\s+7\.\d+/i return :ie7 else return :older_browser end