I have an iframe with that needs to change a global variable in the parent page.
I tried
parent.myvar = "myvalue";
parent.myfunction();
However, it's not working for me. The function executes but the variable remains unchanged.
EDIT: both the iframe and the parent are in the same domain.
iframeis not executed at a time you usemyvaluein the main window. This appears for example if you readmyvaluewithin$(document).ready();in the main window, or have placed your at parsing time executed script just before closingbodytag.