11 Replies Latest reply on Aug 9, 2011 11:04 AM by DFix1

    Odd ExternalInterface.call behavior between browsers

    DFix1

      Sy i have an AJAX function that is embedded into the flex application html page.  For simplicity sake, say it's a hello world function that returns the string that was used as input like HelloFunction("Flex") the return would be "Flex".  The function is on a remote server and the function itself works fine.  When i execute ExternalInterface.call("HelloFunction","Flex"); in ay a button click event, the function works perfectly in Firefox 5, Chrome and Safari.  However, when executing the flex application from IE9, the function does not execute the server request for the function, in fact i know this because i am using fiddler to figure out what's going on.

       

      To eliminate the possibility of having IE9 not supporting the lines of code that i'm executing, i have written an html page with no flex that includes the javascript function and a button to execute that function.  In that case, it works fine as well as the other browsers.

       

      So in summary, an AJAX function that works in flex with firefox 5, chrome and safari and works outside of flex in ie9, firefox 5,  chrome and safari but doesn't work in ie9 inside of flex.

       

      Is there any clue as to what could be causing this?  The javascript function that i'm using looks something like this:

       

             function HelloFunction(arr)

       

      {

       

          var xmlHttp = new XMLHttpRequest();

      var url;

       

         url = "Location/to/server";

       

         var body = '{"input":arr}'; xmlHttp.open("POST", url, true);

       

          xmlHttp.setRequestHeader("Content-Type", "application/json");

       

          xmlHttp.onreadystatechange = function () {

       

              if (xmlHttp.readyState == 4) {

       

                  alert("Response of Hello: " + xmlHttp.responseText);

       

       

              }

       

          };

       

          xmlHttp.send(body);

       

      }