Do I need to specify the plugin in config.xml / trapped in browser

I can’t get the cordovaInAppBrowser to work properly on my device. I ran ‘cordova plugin add cordova-plugin-inappbrowser’, do I need to manually add anything else to the config? I’ve successfully installed and ran plugins like barcode scanner but I can’t get this one to work.

Whenever I open a website through this I am trapped in it and get exit out back to the app. I also get an undefined error on the addEventListener. I know this isn’t supported in Ionic View, but I have tried on an android device, and on an iPhone through Phonegap Build as well as TestFlight. It does seem to work in the phonegap air pair app through.

Here’s an example of the code (I have it wrapped in a $ionicPlatform.ready):
var options = { location: ‘yes’, clearcache: ‘yes’, toolbar: ‘yes’, closebuttoncaption: ‘DONE?’ };
var ref = $cordovaInAppBrowser.open(url, ‘_blank’, options);
ref.addEventListener(‘loadstart’, function (event) {
alert('loadstart: ’ + event.url)
});

Any help is appreciated…I’ve been stuck on this for a couple weeks now :confused:

I’ve used the inappbrowser and didn’t need to manually change anything in config.xml. I didn’t use it with ngCordova though, just replacing window.open as in the plugin documentation.

Interesting, I also had code in the startup that replaces the window.open function, I’ll have to make sure that’s being hit.
So then when you need to open a url do you use the cordova.InAppBrowser.open(url, target, options) call or do you just do a regular window.open()?

I use window.open so it that works both in a regular browser in dev mode and in a webview on android/ios.

I still can’t get the thing to work. I started a fresh project, installed via this line “cordova plugin add cordova-plugin-inappbrowser”, but when running “cordova.InAppBrowser” is undefined. I still have no problem with plugins like camera or barcode scanner, which makes this more frustrating.
To test I am running in the PhoneGap Dev App, and the cordova.InAppBrowser is always false. I also installed to my phone via phonegap build, but that doesn’t even hit on window.cordova…

$ionicPlatform.ready(function () {
    if (window.cordova) {
        alert('cordova ready');
    }
    if (cordova.InAppBrowser) {
        alert('cordova.InAppBrowser ready');
    } else { 
        alert('cordova.InAppBrowser NOT ready');
    }
});

I would try building a native package with ionic build then run in an emulator with ionic emulate, just to make sure the issue is not related to the PhoneGap Dev App.