简体   繁体   English

从主窗口隐藏iframe

[英]Hide iframe from main window

I have 2 <iframe> on my main HTML form. 我的主要HTML表单上有2个<iframe>

These <iframe> are loaded from different external domains. 这些<iframe>是从不同的外部域加载的。 Sometime external server goes offline and user see The page can't be dispayed message on my page. 有时外部服务器脱机,用户看到我The page can't be dispayed消息。

Is there a way to hide these <iframe> when target server is not available? 当目标服务器不可用时,是否可以隐藏这些<iframe>

You can use onload event to display iframe content. 您可以使用onload事件显示iframe内容。 Make iframe invisible by default and set visible in onload event, 默认情况下,使iframe不可见,并在onload事件中将其设置为可见,

您可以为load事件设置一个侦听器,如果在特定时间段内未调用此事件,则可以隐藏框架。

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

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