0 Replies Latest reply: Jan 25, 2012 10:17 AM by Vladimir Patt RSS

    Exchanging data with iFrame from another domain (Same Origin Policy)

      Hi,

       

      I'm trying to integrate some widget I created with GWT-OpenLayers which interacts with our server in order to get some additional data and draw objects on the map.

      The problem I’m running in is: the iFrame can't interact with parent window and vice versa due SOP (Same Origin Policy) restrictions of the browser - I didn't find how to do this with QlikView API.

       

      I found several packages which doing some messaging stuff between iFrames.

      Here some initialization code I've got from the Porthole JS library which should run when the web page loaded and iFrame created on it:

       

      /* Create map window */   

      function createComponentIfNeeded(component) {

           if(!component.framecreated) {

                var el = document.createElement("iframe");

                el.setAttribute("id", GWTOPENLAYERSWIDGETFRAME_EXTENSION);

                el.setAttribute("name", GWTOPENLAYERSWIDGETFRAME_EXTENSION);

                el.frameBorder = 0; //optional el.style.width = component.GetWidth() + "px";

                el.style.height = component.GetHeight() + "px";

                component.Element.appendChild(el);

                el.setAttribute("src", SCHEMA_GWT_OpenLayers_Widget_URL);

                component.framecreated = true;

           }     

      }

      Qva.AddExtension(EXTENSION_NAME, createComponentIfNeeded, false);

      .......

      function createWindowProxy() {    

           windowProxy = new Porthole.WindowProxy(JETTY_SERVER + "/proxy.html", GWTOPENLAYERSWIDGETFRAME_EXTENSION);         

           windowProxy.addEventListener(onMessage);

      }

       

      window.onload = function() {  

           createWindowProxy();  

           updateData(this);

      };

       

      The frame created and map appears and all initialization server stuff done, but  unfortunately window.onload not called in any point (I checked it with Chrome debugger), please advise how to register and on which event?

      Please advise how should I send data to the GWT widget in I frame?

       

      I'm new to QlickView extensions, and I'll appreciate guidance in finding of the “Creating QV Extensions reference”, which I didn't find here.

       

      Thanks,

      Vladimir