UPD:彼らはこのコードのFFとOperaも刈っていると言いますが、別の方法で:)
この理由は、スクリプトを使用したドキュメントツリーの操作です。 より正確には、オブジェクトのiframeをドキュメント内の別の場所に転送し、フレームの線形順序を変更します。
いくつかの調査の後、次のパターンが明らかになりました。
- ページを離れると、IEは現在の(変更された)ドキュメントツリーをバイパスするフレーム内のリンクを記憶します
- ページに戻ると、ソースツリーでフレームが検索され、最後のステップで保存されたアドレスがフレームにロードされます。 フレームの順序が異なるため、おweができます
- スクリプトがトリガーされ、フレームが所定の位置に収まりますが、それらのコンテンツは既に混合されています
いつものように、1つの例は1000回の説明よりも優れています。 次のページで、「リンクのテスト」をクリックしてから戻ってください。
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
Copy Source | Copy HTML < html >< body > < div id ="container"> < iframe src ="http://google.com/" id ="frame1"></ iframe > < iframe src ="http://microsoft.com/"></ iframe > < iframe src ="http://habrahabr.ru/"></ iframe > </ div > < div >< a href ="http://google.com/"> Test link </ a ></ div > < script type= "text/javascript" > document.getElementById( "container" ).appendChild(document.getElementById( "frame1" )); </ script > </ body ></ html >
ところで、バグはIEでのみ複製され、(興味深いことに)Microsoftサイトの1つで最初に発見されたようです:)