JavaScript Cordova In App Browser event not firing IOS cordova browser event

Trying to authenticate users on my ionic application through an external service and I need to use cordovas In app browser! The code works perfectly on android however on iOS the "loadstop" event never fires and thus, the browser never redirects itself back to the application. The code I have looks like this:

$rootScope.$on('$cordovaInAppBrowser:loadstop', function (e, event) {
        console.log('inappbrowser loaded', event);

        var regex = /* regex to determine if url is correct redirected url */
        var res = regex.test(event.url);
        alert('loaded: ' + event.url);
        alert('regex result: ' + res);
        if(res === true) {
          $cordovaInAppBrowser.close();
        }
      });

      if(okta) {
        if (typeof window.localStorage.msRefreshToken === 'undefined') {
          document.addEventListener('deviceready', function () {
            $cordovaInAppBrowser.open('urlforExternalservicehere', '_blank', options);
          }, false);
        } else {
          TokenStore.refreshAccessToken();
        }
      }

when the code is run no alert appears on the screen. Also, once the app has reached the external service and the username of the user is entered, it is then redirected to another url, which the user will then use another set of credentials to authenticate against. This in turn returns a token for the application to authenticate use.

Thus, in a perfect iOS world where it matches the current android experience, the loadstop event fires three times, and the third time the "loadstop" event would fire and the regex would return true and close the in app broswer.

If I need to supply more code to help solve this issue please let me know!

Cordova Version: 4.2.0
Ionic: 1.4.5
iOS: 8 and 9
Using NgCordova for Cordova functionality

UPDATE: when running the application on an emulator and checking the console logs, I find this error:

Error: Module cordova-plugin-inappbrowser.inappbrowser does not exist., http://10.117.1.46:8100/cordova.js, Line: 1402

I have the plugin installed so I don't know how its missing the plugin. Does anyone have a remedy for this? Thanks!

Answer:1

There are two conditions: The div (and the divs inside) must have a variable height. The divs inside must add a border on hover over them. There is a problem: The border of the hover adds height to ...

There are two conditions: The div (and the divs inside) must have a variable height. The divs inside must add a border on hover over them. There is a problem: The border of the hover adds height to ...

I'm trying to dynamically populate a ion-select dropdown with a json object. My html component looks like this: <ion-item [hidden]="editOptions.isEditing"> <ion-note stacked color="...

I'm trying to dynamically populate a ion-select dropdown with a json object. My html component looks like this: <ion-item [hidden]="editOptions.isEditing"> <ion-note stacked color="...

  1. ionic populate select
  2. ionic 3 populate select
  3. ionic 2 populate select

There is an imaginary square which I want to draw as two halves, i.e. two triangles. Whilst they should perfectly fit together and make a square, a tiny line caused by anti-aliasing appears. These ...

There is an imaginary square which I want to draw as two halves, i.e. two triangles. Whilst they should perfectly fit together and make a square, a tiny line caused by anti-aliasing appears. These ...

  1. html5 video anti aliasing
  2. canvas html5 anti aliasing
  3. html5 canvas no anti aliasing
  4. anti aliasing html5

imagine your wife asks you to go buy some Campion flowers. as it’s a rare kind of flower you’re not sure if you can find it the flower shop next door. so you’ll have to check every single flower shop ...

imagine your wife asks you to go buy some Campion flowers. as it’s a rare kind of flower you’re not sure if you can find it the flower shop next door. so you’ll have to check every single flower shop ...

  1. on higher order thinking skills
  2. on higher order derivatives
  3. questions about higher order thinking
  4. problems about higher order derivatives