如何查看子浏览器窗口是否已完成加载? [英] How can I check to see if a child browser window has finished loading?

查看:56
本文介绍了如何查看子浏览器窗口是否已完成加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在弹出新窗口的页面上有一个链接,有时第二个窗口需要很长时间才能加载。
我想禁用父窗口上的链接,直到子窗口完成加载。
我知道我可以让子窗口onload()来提醒父母,但我不想惹恼孩子,所以我有一个小的javascript轮询子窗口,看它是否有任何数据,除了它不起作用。
我不能newwindow.document.getelementbyid因为我永远无法确定该页面上是否会有任何特定元素。
我只是想知道某个地方是否有它。

I have a link on a page that pops up a new window, and sometimes that second window takes a long time to load. I want to disable the link on the parent window until the child window finishes loading. I know I can have the child window onload() to alert the parent, but I don't want to mess with the child, so I have a little javascript that polls the child window to see if it's got any data, except that it doesn't work. I can't newwindow.document.getelementbyid because I can never be sure there's going to be any particular element on that page. I just want to see if there's a in it somewhere.

推荐答案

你可以尝试获取body标签,检查是否有孩子。如果是,则页面加载或非常接近。足够接近IMO。

You could try getting the body tag, and inspecting if it has children. If it does then the page is either loaded or very close. Close enough IMO.

如果孩子的URL不是同一个域,则无法执行任何操作。这将是一个XSS漏洞。

If the child's URL is not the same domain, you can't do anything. That would be a XSS vulnerability.

这篇关于如何查看子浏览器窗口是否已完成加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆