I have an simple app that onDeviceReady
starts the InAppBrowser and shows a website. Then The InappBrowser will be closed when a specific event occurs.
As you may know, on Android platform pressing "back button" closes the InAppBrowser which I want to be prevented. I want to InAppBrowser be shown to user until that event occurs and user be unable to close the InAppBrowser.
Be noted that I am not talking about hardwareback
options. hardwareback
is a useful option which lets user goes back in history of his/her navigation by pressing "back button" but at the first page (when there is nothing left in history), it closes InAppBrowser while I want InAppBrowser still remains open.
In the latest InAppBrowser versions you still have to change the onBackPressed
function in the JAVA code of InAppBrowserDialog.java
plugin code:
public void onBackPressed () {
if (this.inAppBrowser == null) {
this.dismiss();
} else {
// better to go through the in inAppBrowser
// because it does a clean up
if (this.inAppBrowser.hardwareBack() && this.inAppBrowser.canGoBack()) {
this.inAppBrowser.goBack();
} else {
// this.inAppBrowser.closeDialog();
}
}
}
I don't like this approach I have asked a feature on GitHub; you can follow it on GitHub here: https://github.com/apache/cordova-plugin-inappbrowser/issues/530
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With