I want to use the backkey @ android phones to go back to some specific page. My code(JS):
function onBackKeyDown() {
currentId = $.mobile.activePage.attr('id');
if(currentId == "#swipediv"){
$.mobile.changePage("#home", "slide", false, true);
}
else{
history.go(-1);
}
}
HTML:
<div data-role="page" data-theme="a" id="home">
<div data-role="header"><h1>Test</h1></div>
<div data-role="content">
<p>Home</p>
</div>
</div>
</div>
<div id="swipediv">
<div data-role="page" data-theme="a" id="1">
<div data-role="header"><h1>1</h1></div>
<div data-role="content">
<p>1</p>
</div>
</div>
</div>
What's wrong ? Any suggestions?
best regards