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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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:> 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 > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Feb 12, 2007, at 7:41 PM, Ben Munat wrote:> > 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: >> 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 >> >>> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Check out http://www.quirksmode.org/js/detect.html for a nice piece of Javascript code to detect on the client side. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.agilewebdevelopment.com/plugins/browser_detect On 2/13/07, Wes Gamble <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Check out http://www.quirksmode.org/js/detect.html for a nice piece of > Javascript code to detect on the client side. > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---