Get events with InAppBrowser

Hi guys,

I’m actually building an app at one step of the registration you’re redirected to a page where you have to confirm something. The webpage is opened thanks to InAppBrowser but I wanted to know where the page is closed or if I can get some informations of what happen on the page.

I tried this in the controller based on what I found on google:

.controller(“testCtrl”, function ($scope, $cordovaInAppBrowser, $rootScope) {

    var options = {
        location: 'yes',
        clearcache: 'yes',
        toolbar: 'no'
    };
    $scope.openBrowser = function() {
        $cordovaInAppBrowser.open('http://ngcordova.com', '_blank', options)
            .then(function(event) {
                console.log("success", event);
            })
            .catch(function(event) {
                console.log("error", event);
            });
    };
    $rootScope.$on('$cordovaInAppBrowser:loadstart', function(e, event){
        console.log("start", e, event);
    });
    $rootScope.$on('$cordovaInAppBrowser:exit', function(e, event){
        console.log("exit", e, event);
    });
})

And just this in the html file:

    <button class="button" ng-click="openBrowser()">open page</button>

The webpage is opening well but I can’t get any infos, no one of the console.log are displaying something.
Any idea how this could work?

(sorry for my english)
Thanks

1 Like