file_bug1121701_2.html (665B)
1 <script> 2 var bc = new BroadcastChannel("file_bug1121701_2"); 3 bc.onmessage = (msgEvent) => { 4 var msg = msgEvent.data; 5 var command = msg.command; 6 if (command == "setInnerHTML") { 7 window.document.body.innerHTML = "<img>"; 8 window.onmessage = function() { 9 bc.postMessage({command: "onmessage"}); 10 window.document.body.firstChild.src = msg.location; 11 bc.close(); 12 }; 13 window.onbeforeunload = function() { 14 window.postMessage("foo", "*"); 15 }; 16 17 history.back(); 18 } 19 } 20 window.onpageshow = function(e) { 21 bc.postMessage({command: "child2PageShow", persisted: e.persisted}); 22 }; 23 </script>