How to check if all frames have been loaded?
I need to determine if in a given moment all frames have been loaded and wait if not. This is because I need to call an iframe method when user clicks on a link:
for (var i = 0; i < window.frames.length; i++) {
if (window.frames[i].getName() == name) {
......
}
}
开发者_运维问答
and it returns the error window.frames[i].getName is not a function
if user clicks too fast (no time to load).
So I need to check if all frames have been loaded and then if not, wait until it happens. Thanks.
See this answer: Hide the iframes whose content get blocked by proxy
The code at that answer does not only show whether a frame is loaded or not, but also whether the page is successfully loaded or not.
精彩评论