2 Replies Latest reply on Jan 11, 2012 4:53 AM by Prabodh Bhatt

    query related ExternalInterface and chrome popup blocker

    Prabodh Bhatt

      I want to call js function on service  response my code is as below

       

      when I run this in google chrome, If I click directJs button It works properly,

      It open new window.

      But when I call js(ExternalInterface ) from service response It stuck in popupblocker

      My aim is to execute js function from service responce in google chrome browser

      please guide with solution.

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

       

                <mx:Script>

                          <![CDATA[

                                    import mx.messaging.messages.HTTPRequestMessage;

                                    import mx.controls.Alert;

                                    import com.adobe.serialization.json.JSON;

                                    import mx.rpc.events.FaultEvent;

                                    import mx.rpc.events.ResultEvent;

       

                          import mx.rpc.http.HTTPService;

       

                          private function CallService():void

                          {

                                    var myService:HTTPService = new HTTPService();

                                    myService.addEventListener(ResultEvent.RESULT, ResultEventFunction);

                                    myService.addEventListener(FaultEvent.FAULT,FaultEventFunction);

                                    myService.useProxy = false;

                                    myService.method = HTTPRequestMessage.GET_METHOD;

       

                                    myService.url = "https://www.googleapis.com/books/v1/volumes?q=science";

       

                                    myService.send();

       

                          }

       

                          private function ResultEventFunction(e:ResultEvent):void

                          {

                                    ExternalInterface.call( "window.open", "http://www.google.com", "_blank" );

                                    lbl.text = "service result";

                          }

       

                          private function FaultEventFunction(e:FaultEvent):void

                          {

                                    ExternalInterface.call( "window.open", "http://www.google.com", "_blank" );

                                    lbl.text = "service fault";

                          }

       

                          private function CallJS():void

                          {

                                    ExternalInterface.call( "window.open", "http://www.google.com", "_blank" );

                                    lbl.text = "direct js";

                          }

       

       

                          ]]>

                </mx:Script>

       

       

                <mx:Button label="CallJS" click="CallJS()"/>

                <mx:Button label="CallService" click="CallService()"/>

                <mx:Label id="lbl"/>

      </mx:Application>