Hi all , I am new for ROR . Is there any way to detect the browsers from rails application?? I having some issue of designing due to that, my tabs create gap, which is not there.??? Any Idea? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, yes, there are ways to detect the browser. You should also consider starting off with a professionally designed web site and just modify the contents. Unless you intend to tackle learning Rails and styling around browser differences (which have entire books written just for this). Check out Open Source Web Developers for free templates to jump start your site. http://www.oswd.org/ -- James Mitchell On Tue, Nov 25, 2008 at 6:42 AM, saurav <contactsaurav1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all , > I am new for ROR . Is there any way to detect the browsers > from rails application?? > I having some issue of designing due to that, my tabs create gap, > which is not there.??? > Any Idea? > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Nov 25, 2008, at 3:42 AM, saurav wrote:> > Hi all , > I am new for ROR . Is there any way to detect the browsers > from rails application?? > I having some issue of designing due to that, my tabs create gap, > which is not there.??? > Any Idea? >Yes. Look in request.user_agent. So you might do something like this: def ua_identifier(ua_string) return :chrome if ua_string =~ /Chrome/i return :ie if ua_string =~ /MSIE/ return :safari if ua_string =~ /Safari/ return :firefox if ua_string =~ /Firefox/i end and then do_safari_stuff if ua_identifier(request.user_agent) == :safari The code I showed only figures out what generic kind of browser you are receiving a request from. Hope this helps. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---