Phonegap + JQM:android上的本地文件问题

时间:2012-02-23 18:18:48

标签: jquery jquery-mobile cordova

我知道这是一个常见的问题,但我很难理解 我的结果基于我看到的各种答案。

我有一个使用多个本地html文件的phonegap + jquery移动应用程序。该 层次结构看起来像这样

index.html
  |
  --- A.html  (uses getJSON() to server to get list)
  |     |
  |     --- A1.html  (uses getJSON() to server to get details)
  |
  --- B.html  (uses getJSON() to server to get list)
        |
        --- B1.html    (uses getJSON() to server to get details)

html和js资产是本地的。我正在使用jquery mobile。

黑莓上的一切都很好。在android,index.html,A.html, 和B.html工作正常。当试图访问详细信息视图A1和 B1,我收到“错误加载页面”。

我无法理解为什么A和B有效,但A1和B1没有。

虽然不确定为什么这会对另一个产生影响 我找到了添加

的建议
android:configChanges="orientation|keyboardHidden"

清单中的活动。这并没有改变任何事情。

如果它与jquery相关,我尝试添加以下内容:

$( document ).bind( "mobileinit", function() {
    // Make your jQuery Mobile framework configuration changes here!
    $.mobile.allowCrossDomainPages = true;
    $.support.cors = true;
});

仍然没有爱。关于如何修复或调试这个的任何想法?

谢谢, 亚伦

2 个答案:

答案 0 :(得分:0)

“错误加载页面”意味着jQuery Mobile无法找到该文档,这可能意味着您正在使用关联URL并且它们被基本网址搞砸了。尝试使用绝对URL。

答案 1 :(得分:0)

此问题与webview错误有关,该错误在URL中传递数据时会导致错误。

http://code.google.com/p/android/issues/detail?id=17535

从A到A1的网址看起来像A1.html?id = 1,其中?id = 1导致问题。

干杯。