I will show you how you can communicate between browser windows. We already know we can access it via parent. method but there is another way of doing it .
parent.html
<html>
This is parent page
<iframe src="childIframe.html" id="frame1" />
<script>
window.open("child.html");
function callParent(){
alert(" I am at parent");
// accessing child element of iframe make sure iframe loaded completely before you call this // will hide the div form the lunched window
$($("#frame1").contents().find("#sampleDiv")).hide();
}
</script>
</html>
child.html
<html>
This is child
<script>
window.opener.callParent(); // accessing parent
</script>
</html>
childIframe.html
<html>
This is a Iframe
<div id = "sampleDiv"> Hello </div>
</html>
parent.html
<html>
This is parent page
<iframe src="childIframe.html" id="frame1" />
<script>
window.open("child.html");
function callParent(){
alert(" I am at parent");
// accessing child element of iframe make sure iframe loaded completely before you call this // will hide the div form the lunched window
$($("#frame1").contents().find("#sampleDiv")).hide();
}
</script>
</html>
child.html
<html>
This is child
<script>
window.opener.callParent(); // accessing parent
</script>
</html>
childIframe.html
<html>
This is a Iframe
<div id = "sampleDiv"> Hello </div>
</html>