0

Hello Urigo https://stackoverflow.com/users/1426570/urigo

I am hitting the cross domain scenario and tried your solution.. yet cross domain solution from you will be great help. Thanks in advance

Angularjs: call other scope which in iframe

Parent Frame is running on 8200 port

<div ng-controller="MyParentController">
<iframe frameborder="0" allowtransparency="true" scrolling="no" src="http://localhost:8999/Others/abcd.html" style="width: 100%; height: 800px;float:left"> 
</iframe>
</div>

In the child iFrame i have a button and following controller function in

  app.controller('MyCtrl', ['$scope','$log','$window', function($scope,         $log,$window ) {

 $scope.invokeParentFunction = function(){

 console.log(" Child invokeParentFunction function was called ");

 var parentScope =          $window.parent.angular.element($window.frameElement).scope();
        console.log("parentScope ", parentScope);
    }
}]);

Following is the error I am getting for not setting up the cross - domain .., which I cannot as my partner won't be allowing to open his production IP to mine for Cross domain calls.

Error: Blocked a frame with origin "http://localhost:8999" from accessing a cross-origin frame. at Error (native) at k.$scope.invokeParentFunction (http://localhost:8999/Others/abcd.js:158:36) at fb.functionCall (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:177:68)

Any suggestions please.

Community
  • 1
  • 1
Raj Rajen
  • 203
  • 2
  • 17
  • unless you can access code for both domains nothing you can do. If you can access code in other domain can set `document.domain` the same in both – charlietfl Jul 15 '15 at 01:59
  • Using this https://github.com/newtriks/angularjs-post-message-testing-project and it worked between Parent and child frames in different ports ( parent frame in 8900 - mostly jQuery, child frame in 9000 - in angularJS) of the same host. Going to check between different hosts. – Raj Rajen Jul 16 '15 at 02:10

0 Answers0