1

How can I automatically close the $cordovaInAppBrowser when it goes to my website and returns content "OK"? I would like to do this to avoid displaying the close button in the browser window.

Does anyone know how I can achieve this?

Dexter
  • 2,462
  • 4
  • 24
  • 28
Joe
  • 37
  • 7
  • see if this helps http://stackoverflow.com/questions/25199691/impossible-to-close-inappbrowser-window-solved?answertab=active#tab-top – Varit J Patel Jun 27 '16 at 07:59
  • Could you share a bit more information about your scenario? Does the URL change when the website returns "OK" and what is this "OK"? The body? The response code? – Dexter Jun 29 '16 at 16:47

2 Answers2

1

I did find the website that can solve this for those who also need to self close the browser in some condition.Here is the reference link : https://developer.salesforce.com/forums/?id=906F00000009ALSIA2

sample coding:

authWindow.addEventListener('loadstop', function(e) {
var loc = e.url;
//when url is changed check if the url contains your specific callbackURL
if (loc.search(data.callbackURL) >= 0) {
//at this point close your inapp browser
//you will land on the index page within your application.
authWindow.close();
//your code after successful authentication
}
});
Joe
  • 37
  • 7
0

you can use something like a timeout function or other than that a even listener other than i would suggest make a custom plugin and use it. The solution provided by @Blouraf is very hacky. I did find some documentation on the cordova plugin that recommends a listener.