To prevent default functionality of device back button

0
Page X-->PageA-->Page B(popup) I have a Page A on click of the button Page B is opened as popup over Page A.Initially when back button of mobile is pressed Page B (popup) is not closed but Page A is closed and app goes backs to its previous page. (Page X).In order to close popup have added event listener for mobile device back button using javascript. Now on clicking the device back button pop up is closed as well as page redirection also happens.How to disable page redirection?   document.addEventListener('backbutton', function(){ //close popup }
asked
2 answers
2

I have been able to disable the device back button completely:

https://forum.mendix.com/link/questions/91003

answered
0

Found this little bit of code that looks hacky but it might work - looks like it simulates a forward button to offset the back button:

window.history.forward();
answered