Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Cordova return button


May 21, 2021 Cordova


Table of contents


Process the return button

You usually want to Android of the application features of the Android return button, such as going back to the last screen. /b10> In order to be able to implement your own functionality, you first need to disable exiting the application when you press the return button.

document.addEventListener("backbutton", onBackKeyDown, false);

function onBackKeyDown(e) {
   e.preventDefault();
   alert('Back Button is Pressed!');
}

Now, when we press the android back Android the alert appears on the screen instead of exiting the app. /b10> This is e.preventDefault()

Cordova return button