0

さまざまなブラウザーで機能する iframe を更新するためのソリューションが必要です。
インターネットで見つけたコードが正しいことを確認できますか、それとも正しい JavaScript を教えてもらえますか?

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

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

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

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

クロム < 19
document.getElementById('iframeId').contentWindow.location.reload();

クロム今
???

Safari と Opera があればいいのですが、上記が重要です。iframe が別のドメインにある可能性があります。

よろしくお願いします!

4

2 に答える 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

于 2013-01-08T15:33:26.070 に答える
0
**Try This**
location.reload();
于 2020-05-17T11:50:18.363 に答える