Skip to content Skip to sidebar Skip to footer

How To Initiate A Javascript Function In An Iframe To Run In The Parent Page?

I have a function in a parent file that depends on several global variables. I am having the child iframe update one of the parent's global variables with parent.myvar = 'myvalue';

Solution 1:

I'm not sure if I understand the question, but couldn't you pass in a variable reference of parent to the child?

Like

var parentRef = this;

so the child could run

parentRef.myFunction();

Post a Comment for "How To Initiate A Javascript Function In An Iframe To Run In The Parent Page?"