IFrame Cross Domain Communication - FireFox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hash4sp
    New Member
    • Aug 2007
    • 55

    IFrame Cross Domain Communication - FireFox?

    Hello

    Can anyone here please guide me with the Cross Domain Communication between IFrames.

    Problem:

    Application1 running on IIS => http://localhost.ad.lo cal/Applicaiton1
    Application2 running on Apache => http://localhost.ad.lo cal:8080/Application2

    The Application2 is being loaded in an IFrame inside Application1; and there needed a communication beetween the two Applications. With IE my application works but with FireFox it doesnt.

    I have tried with several available tips like changing the document.domain property etc., but it doesnt seems to work. I am not able to get the objects from Application2 which is in an IFrame.

    Can anyone please guid me with this issue.

    Thanks & regards,
    Hash
  • rnd me
    Recognized Expert Contributor
    • Jun 2007
    • 427

    #2
    firefox provides several ways to communicate between cross-domain frames.

    look into postMessage and window.name specifically.

    Comment

    • carmarri
      New Member
      • Dec 2009
      • 5

      #3
      Could you please, provide more information and maybe some code in order us to be able to help to you?

      Thanks

      -------------------------------------
      [removed link]

      Comment

      • hash4sp
        New Member
        • Aug 2007
        • 55

        #4
        Hi Carmarri !

        I created test pages.
        1. Page1.html calls Page2.html in an Iframe.
        2. Page1.html is hosted on IIS
        3. Page2.html is hosted on Apache
        4. Now i want to access a variable named "aTestVaria ble" of Page2 from Page1.
        5. This works perfectly in IE, but the problem is in FireFox.

        Thanks !

        Code as follows:

        Code:
        Page1.html  
        ([B][url]http://localhost/app1/page1.html[/url] - app1 virtual dir on IIS[/B])
        ----------------
        <html>
        <head>
        <title></title>
        <script type="text/javascript" language="JavaScript">
        
        function checkIframeVar() {
             var IframeMap = parent.document.getElementById('IframeContainer"');
            //alert("IframeMap.contentWindow = " + IframeMap.contentWindow);
            alert("IframeMap.contentWindow.aTestVariable = " + IframeMap.contentWindow.aTestVariable);
        
        }
        
        </script>
        </head>
        
        <body>
        
        <h1>Welcome</h1></br>
        <div>Parent Page</div> <br>
        <iframe id="IframeContainer" width="562" height="522" src="http://localhost:8080/app2/page2.html"></iframe>
        <input type="button" value="CallGlobalVar" onclick="checkIframeVar();"/>
        
        </body>
        </html>
        Code:
        Page2.html 
        ([B][url]http://localhost:8080/app2/page2.html[/url] - app2 Virtual dir on Apache[/B])
        -----------
        <html>
        <head>
        <title>Iframe Child</title>
        
        <script type="text/javascript" language="JavaScript">    
        
        var aTestVariable = "H e l l o";
        
        </script>
        </head>
        <body>
            <h1>H E L L O </h1> </br>
            <div id='poDiv'>
        	WebPage in IFrame
            </div>
        </body>
        </html>

        Comment

        Working...