Search code examples
cordovainappbrowser

InAppBrowser prevent from closing when close button pressed


InAppBrowser has a toolbar with 'Close' button.

I want to display a confirmation dialogue preventing InAppBrowser from closing if user decides to.

I know I can attach an event to 'exit' but it seems to me that I would rather need an event like 'onExiting'.

ref.addEventListener('exit', function (event) { alert(event.type); });

Any help please?

Thank you :-)


Solution

  • I think the only way you can accomplish this is by modifying the inappbrowser plugin.

    For example, for Android you could modify this click handler to present a dialog before closing.

    You will have to make similar changes to the native code of each platform you use.