Reputation: 23266
In Firefox if I use frames[i].document.readyState
it will say complete even though the frame is executing Javascript.
Is there a way to detect if Javascript is executing in a frame?
Upvotes: 1
Views: 583
Reputation: 344793
Frames run on the same thread as their owner. You can verify this by having a child frame run a long loop whilst the parent has some code executing on a short timer — you'll notice that the parent's timer has to wait until the loop ends before it can execute its callback.
This means that a child frame and its parent cannot execute scripts simultaneously. Your check isn't running until the JavaScript in the child frame has finished executing.
Upvotes: 2