Ich bin eine Einzelseite App für Windows Phone 8.1 in PhoneGap (HTML5 und Javascript) zu entwickeln. Everthing funktioniert gut, aber die einzige Problem kommt in der Handhabung der Zurück-Taste meiner App.Zurück-Taste Problem in Windows 8.1 app (PhoneGap)
Hier ist der Code Struktur meiner app (Single Seite App):
<body>
<div class="Page1">
// Here is the code of First page of my app (Login Wizard.)
</div>
<div class="Page2">
// Here is the code of Second page of my app
</div>
<div class="Page3">
// Here is the code of Third page of my app
</div>
<div class="Page4">
// Here is the code of Fourth page of my app
</div>
<div class="Page15">
// Here is the code of Fifth page of my app
</div>
<div class="Page6">
// Here is the code of Sixth page of my app
</div>
//And so on
</body>
Ich habe versucht, mit verschiedenen Methoden, es zu handhaben, aber nichts funktionierte. Zwei von ihnen sind:
Erstens:
$(document).ready(function() {
document.addEventListener("deviceready", setOverrideBackbutton, false);
});
function setOverrideBackbutton() {
document.addEventListener("backbutton", backButtonTap, true);
}
/**
* Callback after a backbutton tap on windows platforms.
* Do nothing.
*/
function backButtonTap() {
//Do not remove
alert("back button clicked.");
}
Zweitens:
link: function(scope, element, attrs) {
element.on('click', function() {
$window.history.back();
});
}
Aber ich bin nicht in der Lage, dies zu tun. Ich schätze es, weil meine App eine einzelne Seite App ist. was soll ich machen.
Vielen Dank im Voraus.!