Page 1 of 1

Back Button (Android - Nexus 4)? how to control?

Posted: Sat Apr 20, 2013 8:06 pm
by Adriano Di Paulo

document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
if(!($.mobile.activePage.attr('dsid') == 'login')){
alert('');
}
}
how can I avoid the Image


Back Button (Android - Nexus 4)? how to control?

Posted: Sat Apr 20, 2013 8:32 pm
by Alena Prykhodko

Hi!
Can you clearify, please?
What exactly do you want to avoid?


Back Button (Android - Nexus 4)? how to control?

Posted: Sat Apr 20, 2013 8:49 pm
by Adriano Di Paulo

I would like to avoid the usage of the left button on the image above to be used on all pages except the login


Back Button (Android - Nexus 4)? how to control?

Posted: Sun Apr 21, 2013 5:17 am
by Alena Prykhodko

Does the code you've posted work or message alert('') is shown?


Back Button (Android - Nexus 4)? how to control?

Posted: Mon Apr 22, 2013 8:33 am
by Maryna Brodina

Hello! Try to use the following JS:

codedocument.addEventListener("deviceready", function() {
document.addEventListener("backbutton", onBackKeyDown, false);
});
function onBackKeyDown() {
if(!($.mobile.activePage.attr('dsid') == 'login')){
alert('not login page');
} else {
navigator.app.exitApp();
}
}/code


Back Button (Android - Nexus 4)? how to control?

Posted: Fri Jun 27, 2014 12:42 pm
by Kieran Keene

hello -

Where will this JS go?

Is this on page load?


Back Button (Android - Nexus 4)? how to control?

Posted: Fri Jun 27, 2014 1:49 pm
by Kateryna Grynko

Hi Kieran,

No, in custom JavaScript.