For some time now, I have been attempting to establish communication between two iframes that belong to the same domain but are embedded on a page from a different domain.
The issue arises when the browser imposes a custom frameset layer over the content of the iframe. This causes difficulty in retrieving the names of the iframes from within the iframe using parent.iframes[x].name because the script sees the frameset as the parent element.
Here is the snippet of my actual HTML code:
<html>
<head>
</head>
<body>
<p>iframe1</p>
<script type="text/javascript">
var frames = parent.frames;
for(var i=0; i < frames.length; i++)
{
if(frames[i].name != "undefined")
alert(frames[i].name);
}
</script>
</body>
</html>
This is how the browser rendered it:
<!--inside iframe-->
<html>
<head></head>
<frameset border="0" rows="100%,*" cols="100%" frameborder="no">
<!--actual document goes inside frame tag-->
<frame name="TopFrame" scrolling="yes" noresize="" src="http://abnormalz.stuffshake.com/fframe.html">
<frame name="BottomFrame" scrolling="no" noresize="">
<noframes></noframes>
</frameset>
</html>
Is there a possible solution to this dilemma?
You can view the test at