Exit App when no page to go back [v1] vue

mounted() {
    document.addEventListener('backbutton', () => {
          // on device back button go back
          // if in home page exit app?? navigator.app.exitApp();
    }, false)

how to check if there in no page to goback and exit app

In v1 there is no history object on router, so you need to first access the corresponding View instance, and check its history property. And if view.history.length === 1 then there is no more back pages and you can exit the app

1 Like

Thank u vladimir, if u can add this to the doc, we can avoid asking this type of question :smile: