Ionic Inappbrowser to picking up exit event


My app which is built on ionic has an inapp browser that opens a url. This works fine.
I need to identify when and if the user clicks the close/”X” button on it to run a function.

I have tried the exit eventlistener but it is not fired when the browser is closed.

I have tried the below.

var ref =$scope.url, '_blank');


ref.addEventListener('exit', $scope.bclose());
    $scope.bclose = function(){


ref.addEventListener('exit', function(event) { 
   alert('Browser Closed');

I however have a loadstop listener which works fine.
Any help is greatly appreciated.


Try to use following way. It is working fine.

 $scope.openLink = function (url) {

        var ref =, '_blank', 'location=yes');

        ref.addEventListener('exit', function(){


I am using following cordova inappbrowser version in my config.xml

<plugin name="cordova-plugin-inappbrowser" src="" version="1.4.1-dev" />

Answered By – coder

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published