【发布时间】:2012-12-22 11:20:54
【问题描述】:
我需要一个解决方案来刷新适用于不同浏览器的 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);
火狐 12-17 window.document.getElementById('iframeId').src = window.document.getElementById('iframeId').src;
铬 document.getElementById('iframeId').contentWindow.location.reload();
Chrome 现在
???
Safari 和 Opera 会很好,但以上内容很重要。 iframe 可能位于不同的域中。
非常感谢!
【问题讨论】:
-
嗨,这适用于 IE 版本吗?我尝试使用这里提到的但无法重新加载 iFrame。
标签: javascript internet-explorer firefox iframe browser