1

我在我的 Android 应用程序中使用 jquery 向导。到目前为止,我可以看到向导效果,并且我的所有子页面都由标签区分。但是当我的应用程序被 Android 模拟器加载时,这是一个错误。

04-06 15:06:59.939:E/Web 控制台(275):TypeError:表达式“localStorage”[null] 的结果不是对象。在文件:///android_asset/jquery/jquery.mobile.wizard.js:123

<link rel="stylesheet" href="../jquery/jquery.mobile-1.0.1.min.css" />
<link rel="stylesheet" href="../jquery/jquery.mobile.wizard.css" />
<script src="../jquery/jquery-1.7.1.js"></script>
<script src="../jquery/jquery.mobile-1.0.1.min.js"></script>
<script src="../jquery/jquery.mobile.wizard.js"></script>

这是我的页眉:

<script>
$(function() {
    //$( ".inputdates" ).datepicker();
  $('#autoquoteform').wizard({imagebase:'../image'});
  $('#autoquoteform').bind('keypress', function (event) {
    if (event.which == 13) {
      //$.mobile.changePage($("#homepage"));
    }
  });
});
</script>

当我单击向导图标时,会发生此错误。

那么以前有人遇到过同样的问题吗?

4

1 回答 1

1

我通过这样做使它工作:

    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDatabaseEnabled(true);
    try {  
        File filesDir = this.getExternalFilesDir(null);   
        File file = new File(filesDir, "SomeFolder"); 
        if (!file.exists()) {
            file.mkdirs();  
        }
        webView.getSettings().setDatabasePath(file.getAbsolutePath());
    } catch (Exception e) {
         throw new RuntimeException("Failed to mkdir dirs, " + e.getMessage(), e);                                    
    }
于 2012-04-11T19:25:40.593 回答