I worked around it using this:

{{is_mobile=request.user_agent().is_mobile and not 
request.user_agent().is_tablet}}

in layout.html

Naveed

From: Anthony 
Sent: Tuesday, April 03, 2012 08.45
To: web2py@googlegroups.com 
Subject: Re: [web2py] Prevent mobile rendering on iPad/Tablets

  Any future development really needs to be flexible in this regard: iPads are 
not iPhones (and likewise for other device families). OTOH, iPads are not 
desktops either: they have a touch interface. A good responsive design 
framework should handle this properly, and not as a hack.

Note, Skeleton does actually retain the desktop layout on iPads (and any device 
at least 768 CSS pixels wide) -- it doesn't drop to the single-column layout 
until the device falls below 768px (Bootstrap does the same). So, it's probably 
not necessary to edit the skeleton.css file to accommodate iPads.

On the other hand, the mobile menu could use improvement. 
request.user_agent().is_mobile is True even for tablets like the iPad, but we 
don't necessarily want the mobile menu on tablets. It would be helpful if 
request.user_agent() included additional attributes, such as is_tablet (or 
maybe some basic size categories, like small, medium, large). Server-side user 
agent parsing can get tricky, though, so ultimately it's probably best to 
handle as much of the responsive stuff on the client side (via CSS media 
queries and JS) as possible. Another approach with the menu would be to include 
both the desktop and the mobile menus in the HTML, each with its own class. 
Then use CSS media queries to selectively show one and hide the other depending 
on the screen size.

Anthony

Reply via email to