I am calling the parent function like window.parent.functionname();
from the child page. How can i call the window.child.function()
from the parent page to child page.
Any help is appreciated.
A window that opens inside a parent window is a child window. The action taken on the parent window reflects on the child window as well. For example, if you close the parent window, the child window closes too.
If you store a reference to the child window when you call window. open() , then you can poll using setInterval() to see whether the window is still open using the window. closed property. The example below checks twice per second.
Give your iFrame an id and try
document.getElementById("iFrameId").contentWindow.functionname()
This works even when you have multiple iFrames in the same page irrespective of their order.
Do you have an iframe?
Do something like that:
window.frames[0].contentDocument.functionname();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With