I'm using Phonegap for my application and I need to display an external link in a InAppBrowser but it looks like the back botton is not working as expecting: if I'm doing
var ref = window.open('www.example.com/a.html' , '_blank', 'location=no')
from from a.html page I clicked a link to www.example.com/b.html next time when I click back, the InAppBrowser is closed but it should go back to a.html.
Do you know how can I enable the 'navigation history' for InAppBrowser?
Thank you.
This is possible by tweaking the 'InAppBrowser.java'. I know this is little weird but this is the only choice I had. But, those little tweaks I made to the java file now allows me to navigate back within the pages in my app.
Here is the change to be made in InAppBrowser.java, In the 'run' method within showWebPage method, there will be a listener code something like this:
Below that line add the below code,
In addition to what @Suresh Raja wrote, the referenced code doesn't exist anymore. you can add the suggested improved code (following) after this peace of code:
suggested improved code:
this will close the application upon the last back press (which can solve another issue with the inAppBrowser. Hope that helps
EDIT: you should add the
import android.content.DialogInterface
to get this work.You could listen for the back button (assuming you're on android) and inject the history.back call into the InAppBrowser.