file1_bug629227.html 850 B

123456789101112131415161718192021222324252627282930313233
  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. window.onmessage = function(ev) {
  15. if (ev.data == "start") {
  16. doIt();
  17. }
  18. }
  19. document.domain = "example.org";
  20. </script>
  21. </head>
  22. <body>
  23. <iframe id="subframe"></iframe>
  24. <script>
  25. document.getElementById("subframe").src =
  26. "http://test2.example.org" +
  27. location.pathname.replace(/file1_bug629227.html/, "file2_bug629227.html");
  28. </script>
  29. </body>
  30. </html>