I have an HTML frame that I created by running window.open('/a-new-page/', 'my-second-frame');
in the parent page.
When a button is clicked in the frame, I want to trigger a function on the parent page. (In my particular situation, the function updates some of the parent frames HTML)
What is the simplest way to do this?
Both the parent and the frame have the same domain.
By using the window.parent
keyword from within your iframe you can gain access to elements in the parent window if the iframe and the parent window is on the same domain.
Try something like window.parent.yourParentWindowFunctionName()
to call a function in the parent window.