0 Replies Latest reply on Jan 3, 2013 8:14 AM by Coubilias

    SandBoxe Bridge in Multi iFrames

    Coubilias

      Using sandbox bridge between the parent html file like

       

      <script>

      var bridgeInterface = {};

      bridgeInterface.testProperty = "Bridge engaged";

      bridgeInterface.testFunction = function (getMe){

      alert(getMe);

      };

       

      function engageBridge(){

          document.getElementById("mainFrame").contentWindow.parentSandboxBridge = bridgeInterface;

      }

      </script>

       

      <iframe sandboxRoot="http://localhost/" documentRoot="app-resource:/" allowCrossDomainXHR="true"  ondominitialize="engageBridge()" name="mainFrame" ></iframe>

       

       

       

      and the call of it from within the iframe page like

       

       

       

      <script>

      function tryMe(){

      alert(window.parentSandboxBridge.testProperty);

      window.parentSandboxBridge.testFunction('coub2');

      }

      </script>

       

      <a  href="#" onClick="tryMe(); ">Link!</a>

       

       

      works like a charm.

       

      Any ideas how to access the bridge when a second iframe is loaded within the first iframe ?