file1_bug629227.html (850B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script> 5 function doIt() { 6 var doc = window.frames[0].document; 7 var ok = (doc.form1 == doc.getElementById("test1")); 8 window.parent.postMessage( 9 JSON.stringify({ ok: ok, 10 reason: "Should be able to get named items by name" }), 11 "*"); 12 window.parent.postMessage("finish", "*"); 13 } 14 15 window.onmessage = function(ev) { 16 if (ev.data == "start") { 17 doIt(); 18 } 19 } 20 21 document.domain = "example.org"; 22 </script> 23 </head> 24 <body> 25 <iframe id="subframe"></iframe> 26 <script> 27 document.getElementById("subframe").src = 28 "http://test2.example.org" + 29 location.pathname.replace(/file1_bug629227.html/, "file2_bug629227.html"); 30 </script> 31 </body> 32 </html>