Improve closing an HTML page and returning to previous page.

This commit is contained in:
Bryce Curtis
2011-09-29 11:02:54 -05:00
parent a4d66c63a4
commit ebb9f09168
3 changed files with 33 additions and 10 deletions
+10
View File
@@ -59,6 +59,14 @@ App.prototype.clearHistory = function() {
PhoneGap.exec(null, null, "App", "clearHistory", []);
};
/**
* Go to previous page displayed.
* This is the same as pressing the backbutton on Android device.
*/
App.prototype.backHistory = function() {
PhoneGap.exec(null, null, "App", "backHistory", []);
};
/**
* Override the default behavior of the Android back button.
* If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
@@ -91,6 +99,8 @@ App.prototype.addWhiteListEntry = function(origin, subdomains) {
PhoneGap.addConstructor(function() {
navigator.app = new App();
navigator.app.origHistoryBack = window.history.back;
window.history.back = navigator.app.backHistory;
});
}());
}