开发者

How to check if all frames have been loaded?

开发者 https://www.devze.com 2023-04-13 05:30 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消