michael@0: document.domain = "example.org";
michael@0: function $(str) { return document.getElementById(str); }
michael@0: function hookLoad(str) {
michael@0: $(str).onload = function() { window.parent.parent.postMessage('end', '*'); };
michael@0: window.parent.parent.postMessage('start', '*');
michael@0: }
michael@0: window.onload = function() {
michael@0: hookLoad("w");
michael@0: $("w").contentWindow.location.href = "test1.example.org.png";
michael@0: hookLoad("x");
michael@0: var doc = $("x").contentDocument;
michael@0: doc.write('
');
michael@0: doc.close();
michael@0: };
michael@0: function doIt() {
michael@0: hookLoad("y");
michael@0: $("y").contentWindow.location.href = "example.org.png";
michael@0: hookLoad("z");
michael@0: var doc = $("z").contentDocument;
michael@0: doc.write('
');
michael@0: doc.close();
michael@0: }
michael@0: window.addEventListener("message", doIt, false);