Tuesday, January 6, 2015

Intercommunication between parent and child window ( IFRAME and window.open)

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>

Tips on passing Salesforce AI Associate Certification

  🌟 Motivation to Pursue the Salesforce AI Associate Certification 🌟 The world of technology is in a state of perpetual evolution, and on...