GitToTheHub commented on issue #1904:
URL: 
https://github.com/apache/cordova-android/issues/1904#issuecomment-4092338202

   Hi @seamlink-aalves,
   
   the back button does not handle `history.back()` by default. Pressing the 
back button or doing the back gesture will just close the app. If you override 
the back button by `document.addEventListener("backbutton", () => { ... })` 
only your custom js code will be executed. If you leave the callback empty, 
nothing will happen. You have to execute yourself `history.back()` in your 
callback, like e.g.:
   
   ```js
   document.addEventListener("backbutton", () => {
       if (history.length) {
           history.back()
       } else {
           navigator.app.exitApp()
       }
   });
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to