From a same domain iframe I want to create a new function and append it to the parent window and then invoke that function from either the iframe or the parent. Something like this.
parent.myFunction = function(){ ... }; myfunction;
is there a good way to do this?
You can do almost exactly what you did
And from the parent window, you’ll be able to do simply