IE8将缓存中的动态iframe内容重新加载到错误的iframe中 [英] IE8 reloads dynamic iframe content from cache into the wrong iframe

查看:565
本文介绍了IE8将缓存中的动态iframe内容重新加载到错误的iframe中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页上有多个iframe。每个iframe都调用一些javascript,它会动态地将新的iframe写入父窗口的文档。

I have a page with multiple iframes on it. Each iframe is invoking some javascript which dynamically writes new iframes into the parent window's document.

这在第一页加载时工作正常。但是,如果页面在IE8(及更早版本)中刷新,则其中一个动态生成的iframe将从缓存加载到父页面上的一个硬编码插槽中。请参阅以下示例:

This works fine on first page load. But if the page is refreshed in IE8 (and earlier) one of the dynamically generated iframes will get loaded from cache into one of the hard-coded slots on the parent page. See the following example:

http: //www.risingspiral.com/ie8-iframe-refresh/

在IE8中刷新(可能需要几次尝试)Spot 2_将被加载从缓存到spot3.html的iframe。 spot3.html根本不会被调用。

On refresh in IE8 (may take a couple tries) the Spot 2_ will get loaded from cache into spot3.html's iframe. spot3.html will not get called at all.

我已经保护了这里描述的IE动态iframe刷新问题:

I've already protected against the IE dynamic iframe refresh issue described here:

http:// buildingonmud。 blogspot.com/2010/06/ie-iframe-refresh-and-back-button.html

但似乎仍有问题。同样有趣的是,iframes spot2.html和spot3.html之间似乎总是出现问题(至少对我来说)。

But there still seems to be a problem. It's also interesting that the problem always seems to occur (at least for me) between the iframes spot2.html and spot3.html.

我尝试了很多不同的尝试解决此问题的配置。所以,我正在寻找新的建议。

I've tried a ton of different configurations to try and get around this issue. So, I'm hunting for new suggestions.

任何想法?

推荐答案

我有同样的问题并通过每次创建具有不同ID的iframe来修复它(仅在IE11上测试,但希望这可以解决所有版本上的问题):

I had the same issue and fixed it by creating the iframe with a different ID everytime (only tested on IE11, but hopefully this should solve the problem on all versions):

iframe.id = iframe.name = "iframe$" + Math.floor(Math.random() * new Date().getTime());

请注意,设置名称可能没有任何影响(要测试;我只能告诉该设置这个名字只能解决问题。)

Note that setting the name might not have any effect (to be tested; I can only tell that setting the name only does not solve the problem)

这篇关于IE8将缓存中的动态iframe内容重新加载到错误的iframe中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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