Cordova 2.3.0简单设置index.html

Cordova 2.3.0 simple setup index.html eclipse android

本文关键字:设置 index html 简单 Cordova      更新时间:2023-09-26

我下载了Cordova 2.3.0来从Cordova 1.9.0升级。在我的jQuery移动页面成功启动之前,使用以下行和一个javascript函数。

<body onload="onLoad();">

现在我看到他们有一个deviceready事件。我怎样才能使我的申请工作像以前一样。

由于您在PhoneGap平台中运行JavaScript应用程序,因此您可能需要等待PhoneGap完全初始化,这取决于您将要使用的功能。要正确地等待PhoneGap初始化,请使用以下代码:

var callback = function () {
    // Initialization code goes here. If it's just onLoad(), you can 
    // remove this callback function and just use that instead. 
    onLoad();
};
$(document).ready(function () {
    document.addEventListener("deviceready", callback, false);
};