问题描述
我正在尝试用jQuery mobile编写我的第一个Couchapp .在我测试过的每种台式机浏览器(IE/FF/Chrome/Safari)中,该应用程序都可以正常运行.但是,当我在任何移动浏览器(Mobile Safari,Atomic,Android,Opera)中尝试同一页面时,listview无法填充.
I'm trying to write my first Couchapp with jQuery mobile. In every desktop browser I tested (IE/FF/Chrome/Safari), the app functions exactly as intended. But when I try the same page in any mobile browser (Mobile Safari, Atomic, Android, Opera), the listview fails to populate.
起初,我认为这可能与处理我的移动浏览器有关$("#terms").listview( "refresh" );
调用的方式有所不同,但是更改该设置无济于事.我已经验证我使用的视图可以正常工作: http://grc.iriscouch .com/dictionary/_design/dictionary/_view/byacronym .
At first I thought this might have to do with the mobile browsers handling my$("#terms").listview( "refresh" );
call differently, but changing that didn't help. I have verified that the view I am using works correctly: http://grc.iriscouch.com/dictionary/_design/dictionary/_view/byacronym.
有人可以看看我的代码并为我指出正确的方向吗?
Could someone take a look at my code and point me in the right direction?
根据Mobile Safari的控制台,该脚本在第34行引发错误:
According to Mobile Safari's console, the script throws an error on line 34:
$db = $.couch.db("dictionary");
JavaScript Error on Line 34
TypeError: Result of expression '$.couch' [undefined] is not an object.
通过将jquery.couch.js
从/_utils/script
移到vendor/couchapp
来解决此问题.
Fixed the problem by moving the jquery.couch.js
from /_utils/script
into vendor/couchapp
.
推荐答案
实际上,这是因为IrisCouch使用您的User-Agent提供Mobile Futon,因为它认为这是您唯一需要的代码.
Actually, that is because IrisCouch is using your User-Agent to provide Mobile Futon, since it thinks that's the only code you'll ever need.
IrisCouch团队已收到有关此错误决定的建议,并正在寻求解决方案.真正的解决方法是:
The IrisCouch team have been advised of this ill decision and are working on a solution. The real workaround is either:
-
将这些文件复制到本地(就像您所做的一样),但是那样您将浪费自己的磁盘空间,并丢失它们正在执行的任何自动更新
Copy those files locally (like you did), but then you'd waste your own diskspace and lose any auto-updates they are doing
CouchDB的建议解决方案是实际上进入配置"页面,并将httpd/mobile_futon
属性更改为FALSE
The suggested solution from CouchDB is to actually go into your Configuration page and change the httpd/mobile_futon
property to FALSE
这篇关于在桌面浏览器中,简单的CouchDB + jQuery移动应用程序加载列表很好,只是不移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!