InAppBrowser, loadstart, loadstop etc not working... help :(

Hi

I have been struggling trying to get the in app browser to work, I am unable to make use of the loadstart, loadstop, loaderror and exit calls.

In the below code, none of the console logs fire. Although a browser does launch.

Thank for in advance to anyone who can help. :smile:

(function () {
'use strict';

angular.module('SkiFlockApp').controller('SignUpCtrl', ['skiFlockApi', '$scope', '$rootScope', '$cordovaInAppBrowser', '$ionicPlatform', SignUpCtrl]);

function SignUpCtrl(skiFlockApi, $scope, $rootScope, $cordovaInAppBrowser, $ionicPlatform) {

	var self = this;

	$scope.google = function() {

		$ionicPlatform.ready(function() {

			var options = {
				location : "yes",
			    toolbar: "yes"
			};

			$cordovaInAppBrowser.open('http://ngcordova.com', '_blank', options).then(function () {
				console.log("InAppBrowser opened http://ngcordova.com successfully");
			}, function (error) {
			    console.log("Error: " + error);
			});
			
			$rootScope.$on('$cordovaInAppBrowser:loadstart', function(e, event) {
				console.log('loadstart');
			});
			$rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event) {
				console.log('loadstop');
			});
			$rootScope.$on('$cordovaInAppBrowser:loaderror', function(e, event) {
				console.log('loaderror');
			});
			$rootScope.$on('$cordovaInAppBrowser:exit', function(e, event) {
				console.log('exit');
			});

		});

	};

};

})();

Hi – I’m having the same issue. Did you make any progress in finding a solution?

Commit 8da5e25 of cordova-plugin-inappbrowser fixes loadstart not triggering.
Currently there isn’t a release for this, you can use the master branch to make it work for now or wait for a release.

ionic plugin remove cordova-plugin-inappbrowser
ionic plugin add https://github.com/apache/cordova-plugin-inappbrowser

I am using ionic 1.7.14 and I still have this issue. The events never get called

The events do not fire when _self target is used. The events fire when _blank target is used

4 Likes

thanks. that saved me. with explicitli added target ‘_blank’ events finally firing

Thanks.it’s work now