Javascript 应用程序在单击设备后退按钮时崩溃?

Javascript 应用程序在单击设备后退按钮时崩溃?,javascript,android,jquery,cordova,Javascript,Android,Jquery,Cordova,我正在开发android phonegap应用程序。我已经编写了一些代码来禁用后退按钮 function onLoad(){ document.addEventListener("deviceready", onDeviceReady, false); } function onDeviceReady() { document.addEventListener("backbutton", backKeyDown, true); console.log("device is ready")

我正在开发android phonegap应用程序。我已经编写了一些代码来禁用后退按钮

function onLoad(){
    document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
document.addEventListener("backbutton", backKeyDown, true);
console.log("device is ready");
}
function backKeyDown() {
try{
    /document.body.style.cursor = 'none';
    if(!(($('#LoadingImage').is(':visible') )){
        /*document.body.style.cursor = 'none';*/
        jConfirm('Are you sure you want to exit?', 'Confirm', function(r) {        
            if (r == true) {
            localStorage.clear();
                navigator.app.exitApp();
            }      
        });  
    }
    else{

    }

}
catch(err){
    alert(err.message);
}
finally{

}
}
其中加载图像是显示加载符号的div

 <div id="LoadingImage" style="display:none">
            <div id="floatingCirclesG">
                <div class="f_circleG" id="frotateG_01">
                </div>
                <div class="f_circleG" id="frotateG_02">
                </div>
                <div class="f_circleG" id="frotateG_03">
                </div>
                <div class="f_circleG" id="frotateG_04">
                </div>
                <div class="f_circleG" id="frotateG_05">
                </div>
                <div class="f_circleG" id="frotateG_06">
                </div>
                <div class="f_circleG" id="frotateG_07">
                </div>
                <div class="f_circleG" id="frotateG_08">
                </div>
            </div>
        </div>

我的问题是加载div节目时,我单击设备后退按钮,galaxy ace 2.3版中的应用程序崩溃,但在galaxy s2 4.0版中工作正常。请帮助我解决此问题。 提前谢谢