By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

IFrame Cross Domain Communication - FireFox?

P: 55
Hello

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

Problem:

Application1 running on IIS => http://localhost.ad.local/Applicaiton1
Application2 running on Apache => http://localhost.ad.local: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
Dec 13 '09 #1
Share this Question
Share on Google+
3 Replies


rnd me
Expert 100+
P: 427
firefox provides several ways to communicate between cross-domain frames.

look into postMessage and window.name specifically.
Dec 14 '09 #2

P: 5
Could you please, provide more information and maybe some code in order us to be able to help to you?

Thanks

-------------------------------------
[removed link]
Dec 15 '09 #3

P: 55
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 "aTestVariable" of Page2 from Page1.
5. This works perfectly in IE, but the problem is in FireFox.

Thanks !

Code as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Page1.html  
  3. (http://localhost/app1/page1.html - app1 virtual dir on IIS)
  4. ----------------
  5. <html>
  6. <head>
  7. <title></title>
  8. <script type="text/javascript" language="JavaScript">
  9.  
  10. function checkIframeVar() {
  11.      var IframeMap = parent.document.getElementById('IframeContainer"');
  12.     //alert("IframeMap.contentWindow = " + IframeMap.contentWindow);
  13.     alert("IframeMap.contentWindow.aTestVariable = " + IframeMap.contentWindow.aTestVariable);
  14.  
  15. }
  16.  
  17. </script>
  18. </head>
  19.  
  20. <body>
  21.  
  22. <h1>Welcome</h1></br>
  23. <div>Parent Page</div> <br>
  24. <iframe id="IframeContainer" width="562" height="522" src="http://localhost:8080/app2/page2.html"></iframe>
  25. <input type="button" value="CallGlobalVar" onclick="checkIframeVar();"/>
  26.  
  27. </body>
  28. </html>
  29.  
Expand|Select|Wrap|Line Numbers
  1. Page2.html 
  2. (http://localhost:8080/app2/page2.html - app2 Virtual dir on Apache)
  3. -----------
  4. <html>
  5. <head>
  6. <title>Iframe Child</title>
  7.  
  8. <script type="text/javascript" language="JavaScript">    
  9.  
  10. var aTestVariable = "H e l l o";
  11.  
  12. </script>
  13. </head>
  14. <body>
  15.     <h1>H E L L O </h1> </br>
  16.     <div id='poDiv'>
  17.     WebPage in IFrame
  18.     </div>
  19. </body>
  20. </html>
  21.  
Dec 16 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.