简体   繁体   English

如何检查iframe内容是否已加载并可见

[英]How can i check if iframe content is loaded and visible

I use an iframe on a website to show external websites. 我在网站上使用iframe来显示外部网站。 Some external websites doesn't allow the representation in a frame. 一些外部网站不允许在框架中表示。

Does anybody know how I can check the content in the iframe? 有人知道我如何检查iframe中的内容吗? I will check if there is any content presented. 我将检查是否存在任何内容。

Please find the below code example 请找到以下代码示例

var $iframe=$("#id").find('iframe');
if ($iframe.data('src')){ // only do it once per iframe
   $iframe.prop('src', $iframe.data('src')).data('src', false);
}

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

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