Inside http://mydomain1.com/index.html
<html>
<body>
<script type="text/javascript">
var a = 1;
</script>
<iframe src="http://domain2.com/test2.html"></iframe>
</body>
</html>
Inside http://domain2.com/test2.html
<script type="text/javascript">
alert(parent.a); // forbidden
</script>
Any work arounds?
If you need to communicate with the other frame, you could use
postMessage. This is only available on modern browsers (IE8, FF3, Opera 9, Chrome).You cannot really have full access to cross domain frames due to the security reasons (Same Origin Policy).