In rails, how to conditionally load javascript files

Using Rails 3.1, I'd like to load zepto when serving a browser that zepto supports (Zepto supports Safari, Chrome, Firefox and Opera and any mobile WebKit-based browser) and jquery in all other cases.
The motivation of course, is to provide a complete experience from one hand and a minimal file size, particularly for mobile devices, on the other hand.
What's the best technique? Is this approach discouraged? (see Rails 3 Conditional Inclusion of Javascript files for similar question and discouragement).
cheers.

链接地址: http://www.djcxy.com/p/89974.html

上一篇: 本地存储会在旧浏览器中自动下载到cookie中吗?

下一篇: 在rails中,如何有条件地加载JavaScript文件