Watching URL changes in iframe

Hi All,

Is there a way to monitor URL changes in iframe so that I can check if the user close the iframe view or not?

I’m using below code ( copied from one Stackoverflow answers.)

.controller(‘PlaylistCtrl’, function($scope, $stateParams,$sce) {
$scope.url =$sce.trustAsResourceUrl(‘http://ksbakers.com/RSA/ccavResponseHandler.php’);
$scope.iframeLoadedCallBack = function(element){
// do stuff
console.log(element);
alert(element);

}

})

.directive(‘iframeOnload’, [function(){
return {
scope: {
callBack: ‘&iframeOnload’
},
link: function(scope, element, attrs){
element.on(‘load’, function(src){
return scope.callBack(element);
})
}
}}])

Thanks
-R