Skip to content Skip to sidebar Skip to footer

Jquery Mobile Back Button Does Not Work With Cordova 1.9.0 And Android 2.2

I've spent the last few hours pulling my hair out on what should be a simple problem. I'm trying to make use of the backButton feature in JQuery mobile to build a site which has na

Solution 1:

Works fine with cordova 1.9 and Android 2.2. Using back in three different way:

Override backbutton:

document.addEventListener("deviceready", onDeviceReady, false);

functiononDeviceReady() {
    document.addEventListener("backbutton", handleBackButton, true);
}

functionhandleBackButton() {
    console.log("back clicked");
    window.history.back();
}

With data-rel=back

<a data-rel="back"data-role="button">Rel Back</a>

With click handler

<a id="forceBack" data-role="button">ForceBack</a>

...

$("#forceBack").click(function(){
    history.back();
});

For full source - https://gist.github.com/3037838

Post a Comment for "Jquery Mobile Back Button Does Not Work With Cordova 1.9.0 And Android 2.2"