简体   繁体   English

检查iFrame页面是否存在

[英]Checking if iFrame page exists

Is it possible to detect if a document loaded by an iframe exists or not? 是否可以检测iframe加载的文档是否存在? The difficulty is, that the iframe document is from another domain than the parent page. 困难在于,iframe文档来自父页面以外的其他域。

Anything that tells me if the iFrame page exists could be used, such as document title or response status code. 可以使用任何告诉我iFrame页面是否存在的信息,例如文档标题或响应状态代码。

At the end of the day I want to see if the page of the iframe was found or not (timeout or 404). 在一天结束时,我想看看是否找到了iframe的页面(超时或404)。

Has someone a clue? 有线索吗?

That's impossible to achieve with javascript if the site is not on your domain. 如果该站点不在您的域中,则使用javascript不可能实现。 You have no scripting access whatsoever to it. 您没有任何脚本访问权限。 You might perform this check on your server by sending a request to the remote site beforehand and see what it responds. 您可以通过事先向远程站点发送请求并查看其响应来在服务器上执行此检查。 Surely it does an additional request but that's the only way unless of course you don't want to install some plugins on the client browser. 当然,它会发出额外的请求,但这是唯一的方法,除非您当然不想在客户端浏览器上安装某些插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM