Delivering HTML for various mobile/tablet devices using Rails
Using Rails, I can detect user-agent and then serve pages. For ex开发者_开发技巧ample: http://40.snipplr.com/view/35063/
If i do so then i have to write 10+ methods for various devices like ipad, xoom and so on. Is there is any gem already available to do this detection? If not what could be the best approach to take?
My goal is to deliver html contents based on the matrix provided here.
One alternative is using @media to adapt css according to screen resolution of the device, you can check these resources about it:
http://www.w3schools.com/CSS/css_mediatypes.asp
http://www.lifeonlars.com/design/web-design/responsive-web-design-adaptive-layouts-with-media-queries
http://www.w3.org/TR/css3-mediaqueries/
Dont know if it completely suits your case but i felt it was worth to mention.
Cheers!
Given the proliferation of devices we face these days, I think device detection is the road to madness. If you do wish to go down that path, one option is WURFL but I think a better choice is Responsive Web Design using media queries.
精彩评论