Javascript:刷新IFrame浏览器专用

问题描述 投票:0回答:2

我需要一个刷新iframe的解决方案,它适用于不同的浏览器。你能确认,我在互联网上找到的代码是正确的,或者给我正确的javascript?

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);

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

Chrome < 19 document.getElementById('iframeId').contentWindow.location.reload();

Chrome现在?

Safari和Opera会很好,但以上是很重要的,iframe可能在不同的领域。

非常感谢

javascript internet-explorer firefox iframe browser
2个回答
0
投票

在Chrome浏览器23.0.1271.97版本中,我只是尝试使用了

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

而它的工作。你可以试试。

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


0
投票
**Try This**
location.reload();
© www.soinside.com 2019 - 2024. All rights reserved.