IE9 と IE8、FireFox、および Webkit の違いを見てきました。次のコードを検討してください。
親ソース:
<!DOCTYPE html>
<html>
<head><title>iframe test page</title></head>
<body>
<h1>Parent window</h1>
<iframe src="//domain2/iframe.html"></iframe>
</body>
</html>
iframe ソース (別のドメイン):
<!DOCTYPE html>
<html>
<head><title>iframe content</title></head>
<body>
<h1>iframe content</h1>
<script>function redirect() { window.parent.location = "/new-href"; } </script>
<a href="javascript:redirect()">Redirect the parent window please</a>
</body>
</html>
メイン ページが IE8 (または IE8 モードまたは Chrome 23 または FF16 で実行するように設定された IE9) で開かれている場合、リンクをクリックすると //(iframe ドメイン)/new-href に移動しますが、IE9 では //(元の親ドメイン)/new-href
私はまだこの問題を回避する方法を調査しており、さらに情報があれば更新します。
更新: iframe リンクの target="_top" 属性を設定すると、この問題を回避できます。
更新された iframe ソース (別のドメイン上):
<!DOCTYPE html>
<html>
<head><title>iframe content</title></head>
<body>
<h1>iframe content</h1>
<a href="/new-href" target="_top">Redirect the parent window please</a>
</body>
</html>
この更新された iframe コードのリンクをクリックすると、親 (全体) ウィンドウが IE8 と IE9 の両方で //(iframe ドメイン)/new-href にリダイレクトされます (私の知る限り、すべてのブラウザーも同様です)。それがあなたのやりたいことですよね?
たとえば、iframe 内のすべてのタグを作成して、iframe がどこかに移動するのではなく、トップ/メイン/親ウィンドウがどこかに移動するようにしたい場合は、次のようなものを使用します。
$("iframe a").attr("target", "_top");
ターゲット属性のドキュメントも参照してください