Hi, I want to make the divs of my views to take 100% width for mobile browsers and something else for "pc". How can I detect that? Any hints? Thanks! -- 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 -~----------~----~----~----~------~----~------~--~---
Greg Willits
2008-Jun-22 09:08 UTC
Re: How can I detect if the app is accessed from mobile?
On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote:> I want to make the divs of my views to take 100% width for mobile > browsers and something else for "pc". > > How can I detect that? Any hints?Use JavaScript to detect browser type. Google detect browser agent detect mobile browser agent -- gw --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jun-22 09:22 UTC
Re: How can I detect if the app is accessed from mobile?
On 22 Jun 2008, at 10:08, Greg Willits wrote:> > On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote: > >> I want to make the divs of my views to take 100% width for mobile >> browsers and something else for "pc". >> >> How can I detect that? Any hints? > > Use JavaScript to detect browser type.athough of course javascript and css manipulation on some mobile browsers can be extremely quirky. Fred> > > Google > detect browser agent > detect mobile browser agent > > -- gw > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Willits
2008-Jun-22 10:09 UTC
Re: How can I detect if the app is accessed from mobile?
On Jun 22, 2008, at 2:22 AM, Frederick Cheung wrote:> On 22 Jun 2008, at 10:08, Greg Willits wrote: >> On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote: >> >>> I want to make the divs of my views to take 100% width for mobile >>> browsers and something else for "pc". >>> >>> How can I detect that? Any hints? >> >> Use JavaScript to detect browser type. > athough of course javascript and css manipulation on some mobile > browsers can be extremely quirky.Sure. I''ve had pretty good luck in detecting all the big ones Palm, Symbian, Windows Mobile, etc. So, similar to the way most apps are tuned for IE/FF/and hopefully Safari, I focus on mobile looking at least decent on the more common platforms--and of course generally stick to some pretty basic layouts and attempts to use markup to start with (looks better, faster, etc). -- gw --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
How are the users accessing the app? if it is through http from their mobile device, you could you use a service like handsetdetection.com On Jun 22, 8:09 pm, Greg Willits <li...-0Bv1hcaDFPRk211Z5VL+QA@public.gmane.org> wrote:> On Jun 22, 2008, at 2:22 AM, Frederick Cheung wrote: > > > On 22 Jun 2008, at 10:08, Greg Willits wrote: > >> On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote: > > >>> I want to make the divs of my views to take 100% width formobile > >>> browsers and something else for "pc". > > >>> How can I detect that? Any hints? > > >> Use JavaScript to detect browser type. > > athough of course javascript and css manipulation on somemobile > > browsers can be extremely quirky. > > Sure. I''ve had pretty good luck in detecting all the big ones Palm, > Symbian, WindowsMobile, etc. So, similar to the way most apps are > tuned for IE/FF/and hopefully Safari, I focus onmobilelooking at > least decent on the more common platforms--and of course generally > stick to some pretty basic layouts and attempts to use markup to > start with (looks better, faster, etc). > > -- gw--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Willits wrote in post #692457:> On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote: > >> I want to make the divs of my views to take 100% width for mobile >> browsers and something else for "pc". >> >> How can I detect that? Any hints? > > Use JavaScript to detect browser type. > > Google > detect browser agent > detect mobile browser agent > > -- gwCSS would be much, much simpler for this: div { width: 80%; } @media handheld { div { width: 100%; } } -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
News Aanad
2011-May-13 04:33 UTC
Re: Re: How can I detect if the app is accessed from mobile?
Take a look of this link: http://www.arctickiwi.com/blog/mobile-enable-your-ruby-on-rails-site-for-small-screens On Fri, May 13, 2011 at 8:11 AM, Johan L. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Greg Willits wrote in post #692457: > > On Jun 22, 2008, at 1:56 AM, comopasta Gr wrote: > > > >> I want to make the divs of my views to take 100% width for mobile > >> browsers and something else for "pc". > >> > >> How can I detect that? Any hints? > > > > Use JavaScript to detect browser type. > > > > Google > > detect browser agent > > detect mobile browser agent > > > > -- gw > > CSS would be much, much simpler for this: > > div { > width: 80%; > } > > @media handheld { > div { > width: 100%; > } > } > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.