我需要一个用于刷新适用于不同浏览器的iframe的解决方案。
你能确认我在网上找到的代码是正确的吗?或者给我正确的javascript?
IE 7window.document.getElementById('iframeId').contentWindow.location.reload(true);
IE 8window.document.getElementById('iframeId').contentWindow.location.reload(true);
IE 9window.document.getElementById('iframeId').contentWindow.location.reload(true);
Firefox 12-17window.document.getElementById('iframeId').src = window.document.getElementById('iframeId').src;
铬<19document.getElementById('iframeId').contentWindow.location.reload();
Chrome现在
???
Safari和Opera会很好,但以上都很重要。iframe可能在不同的域中。
非常感谢!
在Chrome 23.0.1271.97版本中,我刚刚尝试使用
document.getElementById('iframeId').contentWindow.location.reload()
它是有效的。你可以试试:
document.getElementById('iframeId').contentWindow.location.href = document.getElementById('iframeId').contentWindow.location.href
**Try This**
location.reload();