I am wondering how I can get a script that is inserted into an iframe to execute that contains a window.onload function. Because the iframe is already loaded, when I insert the script it is not executed. I do not want to manipulate the script that is inserted in any way. Is there anyway to either re-create the onload state of the iframe without losing the newly inserted script, or, is there a way to have the script saved into the iframe’s DOM so that it loads when it is refreshed?
You can see the code at http://www.fundifi.com/victor/pixel_sandbox/sandbox.html
If you don’t have any other scripts listening to the window’s load event, you could try to re-fire the load event:
If you can’t run that code from within the iframe, you can try to look for the iframe window from the parent (provided there are no cross-domain issues):