|
1 document.domain = "example.org"; |
|
2 function $(str) { return document.getElementById(str); } |
|
3 function hookLoad(str) { |
|
4 $(str).onload = function() { window.parent.parent.postMessage('end', '*'); }; |
|
5 window.parent.parent.postMessage('start', '*'); |
|
6 } |
|
7 window.onload = function() { |
|
8 hookLoad("w"); |
|
9 $("w").contentWindow.location.href = "test1.example.org.png"; |
|
10 hookLoad("x"); |
|
11 var doc = $("x").contentDocument; |
|
12 doc.write('<img src="test1.example.org.png">'); |
|
13 doc.close(); |
|
14 }; |
|
15 function doIt() { |
|
16 hookLoad("y"); |
|
17 $("y").contentWindow.location.href = "example.org.png"; |
|
18 hookLoad("z"); |
|
19 var doc = $("z").contentDocument; |
|
20 doc.write('<img src="example.org.png">'); |
|
21 doc.close(); |
|
22 } |
|
23 window.addEventListener("message", doIt, false); |