InAppBrowser Can't Subscribe to Event

I’m trying to use Ionic Native’s Inappbrowser. Code taken

 platform.ready().then(() => {
        
        let url = 'https://google.com/'
        let browser = new InAppBrowser(url, '_self');

        browser.on('loadstop').subscribe((event) =>{
            console.log("loadstop");
            console.log(event.url); 
        })

    });

Firstly, I figured out with a lot of trouble that the github doc for cordova’s inappbrowser doesn’t apply to Ionic’s implementation of it; the Cordova plugin should allow:

browser.addEventListener('', function(){})

But instead within Ionic 2 it seems we need to do:

browser.on('event').subscribe(function(e){...})

Yet, my event never fires. I’m browsing all around the place, and my browser never logs the URL to my console.

What’s going on here / what am I doing wrong?

This work for me:

    let option = "location=no,hidden=yes";
    let url = "http://www.muoversi.regione.lombardia.it/planner/jsp/mobile/index.html"
    let browser = new InAppBrowser(url, '_blank', option);
    browser.on('loadstop').subscribe(function(event) {
      console.log("subscribed");
      browser.show();
    });

Docs need a review…

Could you tell me how to retrieve the last url visited ?

I tried this :

browser.on(‘exit’).subscribe(function(event) {
console.log(“URL”+event.url);
});

And

browser.on(‘exit’).subscribe((event) =>{
console.log(“URL”+event.url);
});

But url it’s always null…

TKs

@NicoVTech Sorry I read only today your post. I can’t help because I only try the browser, I didn’t use it until now.

hi, it seems the events are subscribed only if the target is not _self. Is there a way to catch iab events when the target is _self?
thanks