[SOLVED]How to make back button on Android and browser to work?

How do you control the back button on Android so if you in a view have a menu, and from there navigate to a couple of subpages and then go back, and so it stops on the menu page and not exit the app?
With this it is going back but not stopping at the menu page.

app.dialog.alert(“back button on android clicked”)


Any input appreciated, thanks.

Ok, so this works in browser and in fullscreen web app on Android.
So it goes back if you click the browser back button or the hardware back button on Android, and when it comes back to the menu page in the view it is not exiting the app. Just how I want it.

delete history.pushState;
var obj={name:“anyname”,url:window.location.href};

var view = app.views.current;
//var le = view.history.length;
//var na = view.name;
//console.log (view.name,‘this is current view’)
if (!view) return;
if (view.history.length > 1) {


There is a backbutton event in android Exit App when no page to go back [v1] vue