-1

I am making an Android app with Phonegap Cordova and I have a problem with the back button I would like to go back to the previouspage in my app I was looking for some examples but I'm stuck now

I tried this :

document.addEventListener('backbutton', backPressed, false);

    function backPressed()
    {
        navigator.app.backHistory();
    }

It can enter the backPressed() function but navigator.app.backHistory() doesn't work

I also tried with history.back(-1) but it doesn't work too

I don't know if I need to install a cordova plugin

Thank your for your help

1 Answers1

0

Finally,

navigator.app.backHistory() is working fine but my problem was elsewhere. I was using window.location.replace to change pages which was not capturing the page navigation history.

Jon O
  • 6,532
  • 1
  • 46
  • 57