在iframe加载完成后,加载指示器会保留在Firefox中 [英] Loading indicator stays in Firefox after iframe finished loading

查看:128
本文介绍了在iframe加载完成后,加载指示器会保留在Firefox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < iframe src =about:blankonload =this.contentWindow.document.write('some text')> 

效果很好,onload事件用某些文本代替了iframe的内容。 / p>

但是在Firefox中,它会导致纺轮的加载指示器显示您正在加载的页面永远不会消失。只有文本被插入到iframe中,所以没有其他内容在等待被加载。当我从页面中删除iframe,它将消除这个问题,所以我知道,这是造成它的iframe。



它在IE和Chrome中正常工作。



现在,我可以这样做:

 < iframe src =about:blankonload =this.contentWindow.document.write('some text'); t.contentWindow.stop();> 

在Firefox中解决了这个问题,但是它阻止了iframe中的任何图像加载(我不'在示例插入文本中使用任何内容,但稍后会添加)。

那么,我该如何解决这个问题?

解决方案

请确保您调用this.contentWindow.document.close();写入iframe后。


I have an iframe placed in my page's body like this:

<iframe src="about:blank" onload="this.contentWindow.document.write('some text')">

It works well enough, the onload event replaces iframe's content with "some text" and thats it.

BUT in Firefox it causes the spinning wheel "loading indicator" which shows you that the page is being loaded to never go away. There is only text being inserted into the iframe, so there is no other content hanging around, waiting to be loaded. When I remove the iframe from the page it removes the problem, so I know, it is the said iframe which is causing it.

It works correctly in IE and Chrome.

Now, I can do something like this:

 <iframe src="about:blank" onload="this.contentWindow.document.write('some text'); t.contentWindow.stop();">

Which fixes the problem in Firefox, but it prevents any images in the iframe from loading (i don't use any in the example insert text, but they will be added later on).

So, how do i go about fixing this?

解决方案

Make sure you call this.contentWindow.document.close(); after writing to the iframe.

这篇关于在iframe加载完成后,加载指示器会保留在Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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