2013-01-08 66 views
0

我需要一个解决方案来刷新适用于不同浏览器的iframe。
你能证实,我在互联网上找到的代码是正确的或给我正确的JavaScript?Javascript:刷新IFrame浏览器特定

IE 7 window.document.getElementById('iframeId').contentWindow.location.reload(true);

IE 8 window.document.getElementById('iframeId').contentWindow.location.reload(true);

IE 9 window.document.getElementById('iframeId').contentWindow.location.reload(true);

火狐12-17
window.document.getElementById('iframeId').src = window.document.getElementById('iframeId').src;

document.getElementById('iframeId').contentWindow.location.reload();

Chrome现在
???

Safari和Opera会很好,但以上都很重要。 iframe可能位于不同的域中。

非常感谢提前!

+0

喜做这项工作的IE版本?我尝试按照此处所述使用,但无法重新加载iFrame。 – Coder

回答

0

在Chrome版本23.0.1271.97我只是用

document.getElementById('iframeId').contentWindow.location.reload()

试着和它的作品。 你可以尝试:

document.getElementById('iframeId').contentWindow.location.href = document.getElementById('iframeId').contentWindow.location.href