Checking if iframe is ready to be written to
Posted
by
Bilal Aslam
on Stack Overflow
See other posts from Stack Overflow
or by Bilal Aslam
Published on 2010-02-15T22:59:05Z
Indexed on
2010/12/23
8:54 UTC
Read the original article
Hit count: 362
A 3rd party script on my web page creates an iframe. I need to know when this iframe is ready, so I can manipulate its DOM.
I can think of a hacky approach: repeatedly try to modify the iFrame's DOM, and return success when a change we make sticks between two attempts. For this to work, I would prefer a property I can check on the iframe repeatedly.
Is there an alternative, cross-browser evented approach to knowing that the iframe is ready? E.g. can we redefine the onLoad function to call into our code (but I don't know if I can do this, since I didn't create the iframe).
© Stack Overflow or respective owner