InApp浏览器事件无法在Cordova 3.5.0(Android)中运行

时间:2014-08-11 08:19:13

标签: javascript android jquery html5 cordova

我是Cordova的新手。我使用了使用本地数据库的cordova 3.5.0(Android 4.4)创建了一个应用程序。但是当我正在加载外部数据时,app失败了 这是我的inapp.html代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <script type='text/javascript' src='jquery-1.10.2.min.js'></script>

  <script type='text/javascript' src="jquery.mobile-1.4.3.min.js"></script>
<script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //

    function onDeviceReady() {
    alert('onDeviceReady');
   var u = "GET";
var d = "http://10.217.14.95:8081/openmrs-standalone/ws/rest/v1/person/007037a0-0500-11e3-8ffd-0800200c9a66";
var type = "null";
var rep = "null";
$(document).ready(function() {
 alert('ready');
    $.ajax({
        type: u,
        contentType: "application/json;",
        url: d,
        dataType: "jsonp",
        error: function() { alert('error'); },
        statusCode: {
            404: function() {
                alert('404 thrown: page/object not found');
            }
        }
    }).then(function(data) {
     alert('function');
       $('.greeting-id').append(data.uuid);
       $('.greeting-content').append(data.display);
    });
});
}
   </script>
</head>
<body>

<div>
            <p class="greeting-id">The ID is </p>
            <p class="greeting-content">The content is </p>

        </div>
</div>
</body>
</html>

这是我的logcat输出:

08-11 02:43:40.470: W/chromium(1107): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
08-11 02:43:45.820: W/PluginManager(1107): THREAD WARNING: exec() call to File.requestAllPaths blocked the main thread for 24ms. Plugin should use CordovaInterface.getThreadPool().
08-11 02:44:26.220: I/chromium(1107): [INFO:CONSOLE(12)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (12)
08-11 02:44:26.420: I/Choreographer(1107): Skipped 51 frames!  The application may be doing too much work on its main thread.
08-11 02:44:26.560: I/Choreographer(1107): Skipped 48 frames!  The application may be doing too much work on its main thread.

当我执行我的.html文件时,上面的错误显示在logcat中。 请建议如何解决此问题。 提前致谢

0 个答案:

没有答案