防止iframe“此网页不可用”。在网站上显示错误 [英] Prevent iframe "This webpage is not available." error from displaying on website

查看:155
本文介绍了防止iframe“此网页不可用”。在网站上显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法阻止错误此网页不可用。在显示在另一个网站上的iframe中显示?

例如,如果我有一个网站,并且想要在框中显示我的Facebook粉丝,它与一个iframe(通常是Facebook提供的代码)。然而,如果由于某种原因,Facebook已经停止响应或者响应速度缓慢(就像现在这样),我会在我的网站上显示iframe应该显示的以下内容:


此网页不可用。

网页
是http://www.facebook。 com / plugins / likebox.php?id = xxxxxxxxxx& width = 182& connections = 6& stream = false& header = true& height = 287might
暂时关闭,或者可能有
永久移动到新网站
地址。

•有关此错误的更多信息
以下是原始错误消息
错误324(net :: ERR_EMPTY_RESPONSE ):
未知错误。


如果Facebook(或其他网站)不可用,我很高兴不会显示任何东西,或显示相同大小(高度/宽度)的图形,或其他替代方案的主机除了在我的主页上显示错误!它使我的网站看起来打破了用户。



欢迎任何想法!提前致谢

解决方案

您可以使用iframe的 onerror =物业做一些创意。考虑一下:

 < iframe src =foo.baronerror =this.location.reload(); /> 

希望这可以帮助您

编辑:这不再有效。


Is there a way to prevent the error "This webpage is not available." from displaying within an iframe that displayed on another site?

For example, if I have a website and I want to display my Facebook fans in a box, one way to display it is with an iframe (typically Facebook supplied code). However, if for some reason Facebook is down or slow to respond (like it is right now), I get the following displayed on my website where the iframe should be displayed:

This webpage is not available.

The webpage athttp://www.facebook.com/plugins/likebox.php?id=xxxxxxxxxx&width=182&connections=6&stream=false&header=true&height=287might be temporarily down or it may have moved permanently to a new web address.

• More information on this error Below is the original error message Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

If Facebook (or the other website) is not available, I'd be happy not displaying anything, or displaying a graphic of the same size (height/width), or a host of other alternatives EXCEPT displaying an error on my homepage! It makes my site look broken to users.

Any and all ideas are welcome! Thanks in advance

解决方案

You can use the iframe's onerror="" property to do something creative. Consider this:

<iframe src="foo.bar" onerror="this.location.reload();" />

Hope this helps

Edit: This no longer works.

这篇关于防止iframe“此网页不可用”。在网站上显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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